[英]Visual studio 2017 and nuget package
I am creating nuget package which should contain also config file. 我正在创建nuget包,其中还应包含配置文件。 Problem is that if I want to use csproj for nuget package definition, I don't know how to specify that config file should be copied and "copy to output directory" on file set when package is being installed.
问题是,如果我要使用csproj定义nuget软件包,则在安装软件包时,我不知道如何指定应复制配置文件和在文件集上“复制到输出目录”。
https://docs.microsoft.com/en-us/nuget/guides/create-net-standard-packages-vs2017 https://docs.microsoft.com/en-us/nuget/guides/create-net-standard-packages-vs2017
Previously I used nuspec and for install.ps1. 以前,我使用nuspec和install.ps1。
Thanks ( https://docs.microsoft.com/en-us/nuget/guides/create-net-standard-packages-vs2017 ) 谢谢( https://docs.microsoft.com/zh-cn/nuget/guides/create-net-standard-packages-vs2017 )
To include a file, you need to add / modify an update item for the file. 要包含文件,您需要添加/修改文件的更新项目。 If you have set "copy to output directory" to "preserve newest", you might already have one in the csproj file.
如果将“复制到输出目录”设置为“保留最新”,则csproj文件中可能已经有一个。 To include this file into the resulting nuget package, you need to set the
Pack="true"
metadata: 要将这个文件包含在生成的nuget包中,您需要设置
Pack="true"
元数据:
<ItemGroup>
<None Update="config.txt" CopyToOutputDirectory="PreserveNewest" Pack="true" />
</ItemGroup>
Note that depending on your project type (=> web sdk or "normal" sdk is being used) you may see different item types ( None
, Content
) for files. 请注意,根据您的项目类型(正在使用=> web sdk或“正常” sdk),您可能会看到文件的不同项目类型(
None
, Content
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.