Home > Software design >  .NET Core 3.1 Self Contained Application Does Not Have Version Set for Executable
.NET Core 3.1 Self Contained Application Does Not Have Version Set for Executable

Time:04-05

I am deploying an application as a self contained win-x64 application. Doing this generates an .exe that will be used to start the application on the client machine, however I need to have the "Product Version" and the "File Version" set on the .exe. My issue is that this .exe does not have either of those properties set, despite every other binary that is deployed having those properties set.

Here is the publish command that is ran to generate the self contained application binaries:

dotnet publish MyApp.csproj -c MyCustomRelease -r win-x64 --self-contained=true -v normal

Additionally, I have the following properties set for MyApp.csproj set. Here are those:

  <PropertyGroup>
   <TargetFramework>netcoreapp3.1</TargetFramework>
   <GenerateDocumentationFile>true</GenerateDocumentationFile>
   <Configurations>Debug;Release;MyCustomRelease</Configurations>
   <Platforms>AnyCPU</Platforms>
   <AssemblyVersion>3.2.0</AssemblyVersion>
   <Version>3.2.0</Version>
   <FileVersion>3.2.0</FileVersion>
  </PropertyGroup>

But when I check the version of my .exe, I do not see 3.2.0 set for the file or the product versions. However the .dlls generated do have those set correctly. What am I missing?

CodePudding user response:

Your question has already been answered in another StackOverflow question here: https://stackoverflow.com/a/43280282/3424781

I hope this information helps! If the link above answers your question be sure to mark this post as answered so that others who discover it are sent to the correct location.

CodePudding user response:

I think I found my answer. I didn't mention that I was building this on MacOS (and will eventually be built in a linux container in our CICD pipeline) because I wouldn't think my OS would matter for this kind of functionality, however after some serious digging I did find this GitHub issue detailing that customizing the exe for self contained applications relies on Windows APIs.

  • Related