In this previous question of mine, I thought I had worked out setting version information in a VS2022 C# project. But I seem to have run into the issue again and can’t figure it out. The main difference between then and now is that in that previous question I was working on an application, while today I’m working on a DLL.
I have these settings explicitly set in my VS2022 project
And this is reflected in the details in the csproj file:
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>blah blah</Title>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<Version>1.0.2</Version>
<FileVersion>1.0.2</FileVersion>
<AssemblyVersion>1.0.2</AssemblyVersion>
<Authors>blah blah</Authors>
<Description>blah blah blah, blah blah</Description>
<Copyright>Copyright blah blah 2024</Copyright>
</PropertyGroup>
But after building, when I look at the DLL properties via File Explorer I see this:
And for comparison, I tried this powershell command to inspect the DLL, which confirmed the Explorer’s results:
In addition I also set the copyright information in the project, and that is also blank in the DLL’s properties.
So what’s going on here? How come I can’t set either the file or assembly version?
The reason that this is important to me is that I am producing a NuGet package during the build, and it seems the package thinks the DLL is 1.02, but the DLL is not 1.02, and when the NuGet package DLL is loaded into another application, the application falls over as it can’t find the expected DLL version.
FWIW this DLL project was upgraded from VS2017 to a VS2022 project. So the automatic upgrade may have missed something. However, today is the first day that I actually tried setting the DLL’s version properties after leaving them as the default since the start of the project.