.net core自动构建版本号


 

1. 解决方案中新建 AssemblyInfo.cs 类库

代码如下:

using System.Reflection;

using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GZMultiPlatformTest")]
[assembly: AssemblyDescription("GZMultiPlatformTest")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SAS")]
[assembly: AssemblyProduct("SAS 1.0")]
[assembly: AssemblyCopyright("Copyright © SAS 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("CA7543D7-0F0F-4B48-9398-2712098E9324")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.*")]
GarsonZhang www.yesdotnet.com

 

添加后编译会报错,提示一堆特性重复“System.Reflection.AssemblyTitleAttribute”特性重复

> Error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute

> Error CS0579: Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute

> Error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute

不用理会,继续第二步

2. 配置项目 csproj

修改 项目.csproj ,新增配置

<PropertyGroup>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <Deterministic>false</Deterministic>
</PropertyGroup>
GarsonZhang www.yesdotnet.com

 

修改完后重新编译项目,已经可以成功编译,查看 生成的 dll 属性

自动设置了版本号

版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
YES开发框架
上一篇:css样式首行缩进2个长度的宽度 text-indent 属性
下一篇:window远程桌面连接报错:出现身份验证错误。要求的函数不受支持
评论列表

发表评论

评论内容
昵称:
关联文章

.net core自动构建版本
.NET 微服务——CI/CD(1):Jenkins+Gitee自动构建
版本记录
.NET Core,.NET5 固定输出目录,不要版本目录
GZUpdate自动升级服务 .NET C/S Winform客户端程序自动升级演示
使用Hot Chocolate和.NET 6构建GraphQL应用(2) —— 实体相关功能实现
.NET 微服务——CI/CD(2):自动打包镜像
使用Hot Chocolate和.NET 6构建GraphQL应用(4) —— 实现Query映射功能
使用Hot Chocolate和.NET 6构建GraphQL应用(3) —— 实现Query基础功能
【银行】联行查询
.NET Core ResponseCache 浏览器缓存
.NET Core 项目windows server中部署
GZUpdate自动升级程序客户端演示
ASP.NET Core开发者学习路线图
C# ASP.NET Core开发学生信息管理系统(三)
Node.js版本不对引起的 构建失败提示throw new ERR_INVALID_CALLBACK();
.NET Core集成JWT授权验证
DevExpress 组件 历史各版本下载地址【更新:V21.1.5】
.NET Core定时任务(控制台程序)
ASP.NET Core 使用 LESS

联系我们
联系电话:15090125178(微信同号)
电子邮箱:garson_zhang@163.com
站长微信二维码
微信二维码