最近,我的 .exe 文件在构建后使用了不需要的
Product Version
元数据构建。
这是项目配置:
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>1.8.9.28</AssemblyVersion>
<FileVersion>1.8.9.28</FileVersion>
<Version>1.8.9.28</Version>
<PackageIcon>icon.ico</PackageIcon>
<PackageIconUrl />
<ApplicationIcon>icon.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
但是在我构建应用程序后,文件的产品版本变成类似
1.8.9.28+4263e2bb89fab0e2a2ac67af575c54ecf934eac5
Visual Studio Community 2022 版本和 Azure Dev Ops 版本中都发生了这种情况。 我的分布式应用程序使用
Product Version
检查更新,但是,使用此字符串模式,应用程序无法实例化新的 Version
对象。
将这一行添加到项目配置中,上述行为将被禁用
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>