解决方案:错误CS0579“System.Reflection.AssemblyCompanyAttribute”特性重复
使用VS2022创建一个DLL类库编译出错:
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 CS0579 “System.Reflection.AssemblyCompanyAttribute”特性重复 CartonERP.LicenseCore F:\Jonnys_Source\CartonERP\LicenseCore\Source\debug\Debug\net6.0\CartonERP.LicenseCore.AssemblyInfo.cs 14 活动
原因
AssemblyInfo.cs文件由 MSBuild WriteCodeFragment 类生成。
解决方案
打开csproj文件,添加 <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
项目csproj文件参考
HTML 全选
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<BaseOutputPath>..\debug</BaseOutputPath>
<BaseIntermediateOutputPath>..\debug</BaseIntermediateOutputPath>
</PropertyGroup>
</Project>
DLL类库 AssemblyInfo.cs文件
C# 全选
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("CartonERP.LicenseCore")]
[assembly: AssemblyDescription("C/S框架网(www.csframework.com)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("C/S框架网(www.csframework.com)")]
[assembly: AssemblyProduct("CSFramework.Common")]
[assembly: AssemblyCopyright("版权所有 C/S框架网(www.csframework.com) 2010~2023")]
[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("c6c741d7-58d1-4517-937c-39fe60d83817")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网