运行Nuget添加Visual Studio 2022后构建活动
我已经创建了一个本地的Nuget Feed来进行一些测试。为了自动化该过程,我尝试创建一个后构建事件,以执行软件包的“ nuget add”。 Nuget添加失败以:
提供nupkg文件'xxxxx \ bin \ x64 \ debug \ xxxxx.1.0.0.0.nupkg'不是 找到。
但是,当我查看文件夹时,“ Nupkg”文件是我期望的。我在后构建事件中使用以下命令:
nuget add "$(ProjectDir)bin\$(Platform)\$(Configuration)\$(ProjectName).$(PackageVersion).nupkg" -Source "C:\XXXXX\NuGet Local Source"
这是“定时”的问题吗?
如何在后构建活动中执行“ nuget add”?
我找到了”>如何运行' Nuget在Visual Studio中添加'作为后构建EVNET ,但是,我无法说出我在做什么错。
I've created a local NuGet feed for some testing. In an attempt to automate the process, I've tried to create a post-build event to execute the 'NuGet add' for the package. The NuGet add fails with:
Provided Nupkg file 'XXXXX\bin\x64\Debug\XXXXX.1.0.0.nupkg' is not
found.
However, when I look at the folder, the 'nupkg' file is where I expect it to be. I'm using the following command in the post-build event:
nuget add "$(ProjectDir)bin\$(Platform)\$(Configuration)\$(ProjectName).$(PackageVersion).nupkg" -Source "C:\XXXXX\NuGet Local Source"
Is this a problem with 'timing'?
How can I perform the 'NuGet add' in a post-build event?
I found How to run 'nuget add' as a post-build evnet in Visual Studio, but, I can't tell what I'm doing wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过更多的挖掘,我找到了解决方法。我发现 .net Core 2.0“在构建上生成Nuget软件包”具有后构建事件的问题提到使用“ Pack”作为'AfterTargets'。当前的构建事件选项卡不提供“包”作为选项。因此,我使用的过程是填写后建造事件,保存项目并关闭。然后,我编辑.csproj文件并在文件中更改此行:
这使我可以从后构建事件中运行“ nuget”命令。
After some more digging, I found a workaround. I found .Net Core 2.0 "Generate Nuget package on build" issue with Post-build events that mentioned using "Pack" as an 'AfterTargets'. The current build events tab does not offer 'Pack' as an option. So, the procedure I used was to fill in the post-build event, save the project and close it. Then, I edit the .csproj file and change this line in the file:
This allowed me to run the 'nuget' command from the post-build event.