File/Project/Assembly Version

Best practices, code snippets for common functionality, examples, and guidelines.
brodrigues
Posts: 4
Joined: Tue May 11, 2021 9:56 am

File/Project/Assembly Version

Post by brodrigues » Wed Jul 07, 2021 1:20 pm

Hello everyone.

I want to set the .exe file's FileVersion to a fixed specific number. I want to do this to try to have deterministic builds with Ranorex.

I tried doing this by altering the .csproj file like so...

Code: Select all

<PropertyGroup>
	<FileVersion>1.2.3.4</FileVersion>
  	<Deterministic>true</Deterministic>
    	<ProjectGuid>{69F58903-94CB-49F3-B983-478724830446}</ProjectGuid>
    	<TargetFrameworkProfile />
    	<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    	<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
   	<OutputType>Exe</OutputType>
    	<RootNamespace>VIP_vdev_SanityTests</RootNamespace>
    	<AssemblyName>VIP-vdev-SanityTests</AssemblyName>
    	<NoWarn>1591</NoWarn>
    	<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
    	<RANOREX_BIN_PATH Condition=" '$(RANOREX_BIN_PATH)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Ranorex\Studio', 'InstallDir', null, RegistryView.Registry64, RegistryView.Registry32))\Bin</RANOREX_BIN_PATH>
   	<RanorexTargetsPath>$(RANOREX_BIN_PATH)\Ranorex.MSBuild.Targets</RanorexTargetsPath>
    	<projectdefaultrepository>9df31964-10e3-4c32-b808-cd48c1d170bd</projectdefaultrepository>
    	<StartAction>Project</StartAction>
  </PropertyGroup>
And by changing the FileVersion parameter when calling msbuild

Code: Select all

msbuild project.sln /p:Configuration=Release /p:FileVersion=1.2.3.4 
In both cases, the FileVersion of the test's exe file is 1.2.3.4, and is instead a different number every time.

Anyone has any thoughts how to do this? Am I doing something wrong?

Thanks.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7465
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: File/Project/Assembly Version

Post by odklizec » Fri Jul 09, 2021 8:45 am

Hi,

According to below stackoverflow discussion, using /p:FileVersion alone is not enough. Please follow the instructions from the discussion...
https://stackoverflow.com/questions/102 ... ng-msbuild
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration