6

I recently upgraded a C# project from xproj format to the new csproj. During the migration, the old AssemblyInfo.cs has been removed so I'm wondering how I can indicate that my library is clscompliant?

FYI: this is the attribute that was in the AssemblyInfo.cs: [assembly:CLSCompliant(true)]

Jacek Blaszczynski
  • 3,183
  • 14
  • 25
desautelsj
  • 3,587
  • 4
  • 37
  • 55
  • 2
    It does not matter in what source file this attribute appears, put it anywhere. Time to retire it btw, it has not been useful for a decade. – Hans Passant Oct 22 '17 at 01:42
  • @HansPassant a user told me this attribute was necessary so he could use my C# library in his VB.NET app. – desautelsj Dec 26 '17 at 16:14
  • It this was an SO user then post a link so we can vote/answer. If not then it is up to you to make him smarter. – Hans Passant Dec 26 '17 at 16:23

1 Answers1

9

Just add AssemblyInfo.cs back, with only the parts that aren't autogenerated.

There's nothing to stop you from applying assembly attributes in code - it's just that most of the common attributes are provided from the project settings.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Why it's not possible like for **InternalsVisibleTo** (https://stackoverflow.com/questions/42810705/visual-studio-2017-and-the-new-csproj-internalsvisibleto)? I've tried, but it fails because `true` is parsed as a string. What's the correct form of **boolean literal** in a csproj file (MSBuild)? – gsscoder Jan 26 '20 at 08:46
  • @gsscoder: Please ask a new question - it's not at all clear to me what you've got at the moment. – Jon Skeet Jan 26 '20 at 17:31
  • Hi @Jon Skeet, thanks for replying! This is the new question: https://stackoverflow.com/questions/59927051/mark-an-assembly-clscompliant-in-csproj. – gsscoder Jan 27 '20 at 08:00