简体   繁体   English

如何在.Net Core中设置默认内部版本号

[英]How to set default build number in .Net Core

When you are not using .Net Core you could define your Assembly version in AssemblyInfo.cs like so [assembly: AssemblyVersion("2.1.3.*")] . 当您不使用.Net Core时,可以在AssemblyInfo.cs定义您的Assembly版本,例如[assembly: AssemblyVersion("2.1.3.*")] Note in particular the * which means the default build number 特别注意*表示默认的内部版本号

In .Net core as far as I can tell the build number is set in the *.csproj file. 据我所知,在.Net core中,内部版本号是在*.csproj文件中设置的。 However, it appears to not like using an * in version. 但是,它似乎不喜欢在版本中使用* It complains that version number is invalid. 它抱怨版本号无效。

<PropertyGroup>
    <AssemblyVersion>2.1.3.*</AssemblyVersion>
</PropertyGroup>

I have raised an issue on the dotnet/cli project, but to no avail. 我在dotnet / cli项目中提出了一个问题,但无济于事。

So my question is 'How to set default build number in .Net Core'? 所以我的问题是“如何在.Net Core中设置默认内部版本号”?

The easiest thing to do is have your build system pass in the version on the CLI. 最简单的方法是让构建系统传入CLI上的版本。 For example if you were using powershell and appveyor you could pass dotnet build -c Release /p:Version=2.1.3.$env:APPVEYOR_BUILD_NUMBER 例如,如果您使用的是Powershell和Appveyor,则可以传递dotnet build -c Release /p:Version=2.1.3.$env:APPVEYOR_BUILD_NUMBER

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM