[英]Overriding nuget package name when using “nuget pack” with a visual studio project
I am currently generating nuget packages by passing in a csproj file instead of a nuspec file. 我目前正在通过传递csproj文件而不是nuspec文件来生成nuget包。 The problem is that I need to change the name of the nuget package to avoid conflicts with another project.
问题是我需要更改nuget包的名称,以避免与另一个项目冲突。
This is the command I'm running: 这是我正在运行的命令:
"C:\\Program Files\\dotnet\\dotnet.exe" pack C:\\VSTS\\Agent\\_work\\1\\s\\src\\MyProject\\MyProject.csproj --include-symbols --include-source --output C:\\VSTS\\Agent\\_work\\1\\a --no-build /p:Configuration=debug --include-symbols --include-source /p:PackageVersion=2018.10.11.3
I tried appending the following to the command, but it seems to be ignored: 我尝试将以下内容添加到命令中,但似乎被忽略了:
/p:Id=ThisIsWhatThePackageNameShouldBe
And also tried changing the assembly name in the project (but not the project name), and then doing this: 并且还尝试更改项目中的程序集名称(而不是项目名称),然后执行以下操作:
/p:Id=$(AssemblyName)
But this was also ignored. 但这也被忽略了。
Something automatically added a <PackageId>
element into the csproj
file, and that was taking precedence. 某些东西会自动将
<PackageId>
元素添加到csproj
文件中,并且具有优先权。 I updated this value to what I want the package named and now it's working as expected. 我将此值更新为我想要的包名称,现在它可以按预期工作。
I'm guessing the reason /p:Id
argument was being ignored, was because it might have needed to be /p:PackageId
, instead. 我猜测
/p:Id
参数被忽略的原因是,它可能需要改为/p:PackageId
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.