简体   繁体   English

在Visual Studio项目中使用“ nuget pack”时,覆盖nuget包名称

[英]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.

相关问题 使用Visual Studio Pack将构建目录包含在nuget包中 - Include build directory in nuget package using visual studio pack Visual Studio 2017和nuget包 - Visual studio 2017 and nuget package 如何更改 Visual Studio 项目中的 NuGet 包引用以使用 Nuget.config - How to change the NuGet-package reference in a Visual Studio project to use Nuget.config 从Visual Studio 2010项目文件为多个框架目标构建NuGet包 - Build NuGet package for multiple framework targets from Visual Studio 2010 project file 有没有一种从Visual Studio 2015项目自动创建NuGet包的简单方法? - Is there an easy way to automatically create a NuGet package from a Visual Studio 2015 project? 如何从Visual Studio 2017 RC中的.NET Core MSBuild项目创建NuGet包? - How do you create a NuGet package from a .NET Core MSBuild project in Visual Studio 2017 RC? 不使用Visual Studio构建类库(包)NuGet包项目 - Build Class Library (Package) NuGet Package Projects Without Visual Studio Nuget 将多个项目打包到具有所有外部依赖项的单个 Nuget 包中 - Nuget Pack multiple projects into single Nuget package with all external dependencies 如何设置Visual Studio来构建NuGet包? - How do I set Visual Studio to build a NuGet package? 使用dotnetcore pack创建一个部署nuget软件包。 - Create a deployment nuget package with `dotnetcore pack`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM