如何在构建后事件中获取版本号

编程入门 行业动态 更新时间:2024-10-26 16:21:43
本文介绍了如何在构建后事件中获取版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用构建后事件自动创建一个nuget程序包,然后将其复制到我们网络上的共享文件夹中,如下所示(版本号1.0.0.0。在MyLib.nuspec文件中指定):

I want to use post-build event to automatically create a nuget package and then copy it to a shared folder on our network, something like this (the version number 1.0.0.0. is specified inside the MyLib.nuspec file):

nuget.exe pack "$(SolutionDir)MyLib.nuspec" xcopy /Y "$(TargetDir)MyLib.1.0.0.0.nupkg" \\folder\subfolder\NuGetPackages

但是现在我想更新此脚本,以便它也包括程序集版本,但是我无法在构建后事件中获取程序集版本。我需要这样的东西:

This works, but now I would like to update this script, so that it would include the assembly version also, but I cannot get assembly version inside the post-build event. I would need something like this:

nuget.exe pack -Version $(AssemblyVersion) "$(SolutionDir)MyLib.nuspec" xcopy /Y "$(TargetDir)MyLib." + $(AssemblyVersion) + ".nupkg" \\folder\subfolder\NuGetPackages

但是$(AssemblyVersion)变量不存在...有什么想法吗?

But the $(AssemblyVersion) variable does not exists... Any ideas?

推荐答案

此构建脚本对我有用。它在每个构建中打包并发布我的开发版本。非常简单。

This post build script works for me. It packages and publishes my dev versions on each build. Pretty simple.

del $(ProjectDir)bin\Debug\*.nupkg "$(ProjectDir)NuGet.exe" pack "$(ProjectDir)MyProject.csproj" forfiles /P $(ProjectDir)bin\Debug\ /m *.nupkg /c "cmd /c "$(ProjectDir)NuGet.exe" push @FILE -Source \\SHARE\NuGet"

更多推荐

如何在构建后事件中获取版本号

本文发布于:2023-11-03 01:19:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1553894.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本号   如何在   事件中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!