Search code examples
windowsvisual-studiofileproperties

Where does the Product Version of a file's properties come from?


(This is difficult to search for, as when you look for "Windows Product Version", you get a lot of results pertaining to the OS and not of a file)

I am building stuff in VS2022, and want to control the version numbers. After I generate something (in this case a dll), I can right-click on it (in Win10 in this case), select properties, I see the following:

enter image description here

I understand where the "File version" comes from in my VS2022 project. But where does the "Product version" come from?


Solution

  • In poking around, I discovered that by manually setting the "PackageVersion" in the project's properties, I could set what was reported in the "Product Version" in Windows explorer.

    The default version of the PackageVersion is:

    VS2022 Default PackageVersion

    But this confused me as I had not set "VersionPrefix" in my project. When searching online for that symbol, I encountered this question1:

    Setting the version number for .NET Core projects - CSPROJ - not JSON projects

    In which the accepted answer states:

    If Version is unset, use VersionPrefix (defaults to 1.0.0 if unset) and - if present - append VersionSuffix.

    And in circling back to my project where I manually set the PackageVersion to be "1.2.0", I discovered that VS had inserted this into the csproj file:

      <PropertyGroup>
        ...
        <Version>1.2.0</Version>
        ...
      </PropertyGroup>
    

    So mystery solved, but Microsoft's naming policies didn't help.


    1. IMHO my question is almost, but not a dupe of that other question.