The Visual Studio 'project properties' UI provides easy modification of lots of properties for the project, assembly, and packaging capabilities (note: packaging means DLL, EXE, and NuGet packages).
In .NET Framework, VS provided a UI for Assembly Information:
This translates in .NET Framework projects to (by default) an AssemblyInfo.cs (in Properties\AssemblyInfo.cs by default) and writes out the specific AssemblyAttribute (e.g., AssemblyTitleAttribute. It looks like this with the values in the UI from above:
[assembly: AssemblyTitle("This is the file description")]
[assembly: AssemblyDescription("This is a description but actually a Comment")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("My Company")]
[assembly: AssemblyProduct("WindowsFormsApp9")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("My special TM")]
Using the above if you were to look at the file in File Explorer in Windows you'd see these details:
Notice the Description
is not actually showing in File Explorer, but if you do a little PowerShell you can see them all via
(get-item) .\WindowsFormsApp9.exe).VersionInfo | fl
and would show:
Notice that the Title
is in file metadata as the Description and the Description
is in the metadata as Comments. Yeah, I know...but this is how it has been.
In SDK style projects, we use more (by default) MSBuild properties Taking the above the UI in project properties is now distributed in categories but you can easily search for what you need. As you modify them, they are written as MSBuild properties in the proj file. Using the same above things here's what it looks like:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>This is a description but actually a Comment</Description>
<Title>This is the file description</Title>
<Company>My Company</Company>
<Copyright>Copyright ©️ 2023</Copyright>
</PropertyGroup>
</Project>
The above produces the following view in File Explorer:
And from the PowerShell output:
Now observe
- there is no
Trademark
property exposed in the project properties UI or MSBuild property. See this feedback ticket: Cannot modify Trademark property in UI. - The File Description is not what the
Title
says
These are two changes we're looking into but you can remedy these as well. For the File description you can add AssemblyTitle
to your MSBuild property and it will write to the correct metadata. For the Trademark
you have to do that via AssemblyTrademark
attribute in code. You can map the new SDK MSBuild properties to a file like AssemblyInfo.cs like in the .NET Framework case by adding this property:
<GeneratedAssemblyInfoFile>AssemblyInfo.cs</GeneratedAssemblyInfoFile>
which is documented here in migrating from .NET Framework.
This will create a new code file and sync the properties as you build, but also allow you do add the missing Trademark
one as desired.
You can still add AssemblyTrademark
to a file (like AssemblyInfo.cs) and have it written so the result would be this in your generated AssemblyInfo.cs:
[assembly: System.Reflection.AssemblyTrademark("My special TM")]