使用新的 csproj 格式时如何将 C# 程序集标记为符合 CLS?

How to mark a C# assembly as a CLS Compliant when using new csproj format?

我最近将一个 C# 项目从 xproj 格式升级到新的 csproj。在迁移过程中,旧的 AssemblyInfo.cs 已被删除,所以我想知道如何表明我的图书馆符合 cls 标准?

仅供参考:这是 AssemblyInfo.cs 中的属性: [assembly:CLSCompliant(true)]

只需将 AssemblyInfo.cs 添加回来,仅包含未自动生成的部分。

没有什么可以阻止您在代码中应用程序集属性 - 只是大多数常用属性都是从项目设置中提供的。