[英]nuget pack .csproj with custom .nuspec metadata
I would like to pack nuget package using a .csproj
file.我想使用.csproj
文件打包 nuget 包。 Following command will be executed:将执行以下命令:
nuget pack MyProject.csproj -IncludeReferencedProjects
In the project folder I have two nuspec files, one depending to the MyProject.csproj and another which will be used to make a different package but depending on this project to.在项目文件夹中,我有两个 nuspec 文件,一个取决于 MyProject.csproj,另一个将用于制作不同的包,但取决于此项目。 Folder structure looks like:文件夹结构如下:
-ProjectFolder
|-MyProject.csproj
|-AdditionalMyProject.nuspec
|-MyProject.nuspec
When calling the nuget pack
command, it always takes the first nuspec file ( AdditionalMyProject.nuspec
- lower naming) to get metadata for nuget package but the correct nuspec should be MyProject.nuspec
(matching the name of project file).调用nuget pack
命令时,它总是使用第一个 nuspec 文件( AdditionalMyProject.nuspec
- 较低的命名)来获取 nuget 包的元数据,但正确的 nuspec 应该是MyProject.nuspec
(与项目文件的名称匹配)。
Is there a way to tell nuget pack which nuspec it should use when packing a csproj?有没有办法告诉 nuget pack 在打包 csproj 时应该使用哪个 nuspec?
Something like this:像这样的东西:
nuget pack MyProject.csproj -nuspec MyProject.nuspec -IncludeReferencedProjectsenter
AdditionalMyProject.nuspec is a different project, even if it doesn't have a MSBuild project associated (it is a different .nupkg after all), so you're less likely to have tooling problems if you keep the nuspec in its own directory. AdditionalMyProject.nuspec 是一个不同的项目,即使它没有关联的 MSBuild 项目(毕竟它是一个不同的 .nupkg),因此如果将 nuspec 保留在其自己的目录中,则不太可能出现工具问题。 Similar to how different csproj files live in different directories, even when one has a dependency on the other, I recommend putting the different .nuspec files in different directories, even if MyProject is a nuget dependency of AdditionalMyProject.类似于不同的 csproj 文件如何存在于不同的目录中,即使一个依赖于另一个,我建议将不同的 .nuspec 文件放在不同的目录中,即使 MyProject 是 AdditionalMyProject 的 nuget 依赖。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.