Search code examples
c#wpfassemblyinforoslyn-project-system

How do I apply the assembly:ThemeInfo attribute with an auto-generated AssemblyInfo?


After the migration to the new VS 2017 project system, the AssemblyInfo.cs file is now auto-generated by default. How can I add the assembly:ThemeInfo[] attribute to my project that is required by WPF to find the default Themes\generic.xamlfile without disabling the auto-generation?


Solution

  • It doesn't actually matter where the attribute is placed, it is not required to be in a file named AssemblyInfo.cs. Assembly-level attributes can be placed anywhere, it doesn't even need to be a class. I ultimately put them in a file named AssemblyAttributes.cs in the project in case there will be other attributes that need to be added.