我想为blazor-web-app设置System.Reflection.AssemblyVersionAttribute,而不总是手动更改它。
谷歌不知道答案:-(
我如何影响这个值呢?
谢谢!彼得
发布于 2020-11-12 21:23:08
MSBump似乎与.net5.0一起工作。在nuget中搜索它。
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.1.2</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSBump" Version="2.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition="$(Configuration) == 'Debug'">
<BumpLabel>dev</BumpLabel>
<BumpLabelDigits>4</BumpLabelDigits>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration) == 'Release'">
<BumpRevision>True</BumpRevision>
<BumpResetLabel>dev</BumpResetLabel>
</PropertyGroup>
</Project>发布于 2020-11-12 22:58:13
更改AssemblyVersionAttribute的值的一种方法是使用msbuild任务。这个帖子指出了一个很好的Specify assembly version number as a command line argument in MSBuild示例。“普通”应用程序和Blazor应用程序之间没有区别。
如果要使用版本号,下面是一个名为SiteFooter的示例组件
@using System.Reflection
<footer class="main-footer">
<span>
Version: @_version
</span>
</footer>
@code {
private String _version = typeof(SiteFooter).Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
}https://stackoverflow.com/questions/64804213
复制相似问题