how to modify properties of final compiled .exe file on the windows standalone platform?

Hi all,
i would like to add information in final compiled application (windows standalone: myapp.exe) about "Copyright" and change file version from unity version to my own.

Is it possible? If yes, how can i do it?

screenshot with that i would like to do is attached:

3875191--329038--Untitled.png

Thanks in Advance!

Yes. There is an option to "Generate Visual Studio Solution" in the build window. Instead of generating final executable, it generates a visual studio project that builds the final executable. You can then change it in whatever way you want.

[quote=“Tautvydas-Zilys”, post:2, topic: 721115]
Yes. There is an option to “Generate Visual Studio Solution” in the build window. Instead of generating final executable, it generates a visual studio project that builds the final executable. You can then change it in whatever way you want.
[/quote]
Thank you so much. i dit it. I created visual studio solution from unity. Modified “WindowsPlayerVersion.rc” and got it.
3877447--329314--Untitled.png

Well. I work on integration this in TeamCity.
Tautvydas-Zilys, Do you know the way how to create visual studio solution for windows standalone through command line?

Yeah, it's non-obvious. You can do it like this:

EditorUserBuildSettings.SetPlatformSettings("Standalone", "CreateSolution", "true");

You could also rebuild the executable once, and then commit it to your source control and just overwrite the one from the regular build - it should make your build faster.

1 Like

[quote=“Tautvydas-Zilys”, post:2, topic: 721115]
Yes. There is an option to “Generate Visual Studio Solution” in the build window. Instead of generating final executable, it generates a visual studio project that builds the final executable. You can then change it in whatever way you want.
[/quote]

Is this still possible in Unity 2019.3? I am able to open the build in Visual Studios, but I am unable to locate and update the WindowsPlayerVersion.rc?

I do see that WindowsPlayer.rc has a line of code that includes “WindowsPlayerVersion.rc”, and that the Windows PlayerEngine located in the Unity Editor application folder has a file named “WindowsPlayerVersion.rc” but I am unable to change that file.

What is the best approach for updating this file within Visual Studios to where I can still rebuild the project for distribution?

Thank you.

[quote=“Cybernetic_Nick”, post:6, topic: 721115]
Is this still possible in Unity 2019.3? I am able to open the build in Visual Studios, but I am unable to locate and update the WindowsPlayerVersion.rc?

I do see that WindowsPlayer.rc has a line of code that includes “WindowsPlayerVersion.rc”, and that the Windows PlayerEngine located in the Unity Editor application folder has a file named “WindowsPlayerVersion.rc” but I am unable to change that file.

What is the best approach for updating this file within Visual Studios to where I can still rebuild the project for distribution?

Thank you.
[/quote]

Nothing changed in 2019.3. It’s still there:
5503540--564439--upload_2020-2-20_14-10-55.png

It references it from the project directory, not from Unity Editor application folder.

1 Like

[quote=“Tautvydas-Zilys”, post:7, topic: 721115]
Nothing changed in 2019.3. It’s still there:

It references it from the project directory, not from Unity Editor application folder.
[/quote]

Thank you for your help. I was trying to find this file within the Visual Studios solution but it was not showing up within the IDE’s Resource View panel, and then I must have overlooked it when checking through the directory.

Hi,

Thank you for the info. got it working.

I just wanted to confirm this is the only way(compile solution and then change) and that there is no other automation-friendly way, and also wanted to ask the reason the version number doesn't cascade from the app/unity version number.

Thank you

[quote=“localprojects”, post:9, topic: 721115]
I just wanted to confirm this is the only way(compile solution and then change) and that there is no other automation-friendly way, and also wanted to ask the reason the version number doesn’t cascade from the app/unity version number.
[/quote]

It does cascade from Unity version. By default, the version field will be the same as the Unity version.

Automation friendly way: do the change manually once, commit it to your repository and then have automation either build or copy it.

5726134--600199--upload_2020-4-17_17-39-35.png

i want to ask how i can open this file if my computer using 32 bit

While I can generate a .sln file - I'm no C++ expert and without documentation on what to change in WindowsPlayerVersion.rc -- everything I've tried just corrupts the WindowsPlayerVersion.rc file and I have to start over again. There must be more documentation out there but I can't find it?

It's a standard Windows Resource file, and the format is documented by Microsoft: https://docs.microsoft.com/en-us/windows/win32/menurc/about-resource-files

View Code: WindowsPlayerVersion.rc

include

include "UnityConfigureRevision.gen.h"

include "UnityConfigureVersion.gen.h"

include "UnityConfigureOther.gen.h"

VS_VERSION_INFO VERSIONINFO
FILEVERSION UNITY_VERSION_VER,UNITY_VERSION_MAJ,UNITY_VERSION_MIN,UNITY_VERSION_BLD
PRODUCTVERSION UNITY_VERSION_VER,UNITY_VERSION_MAJ,UNITY_VERSION_MIN,UNITY_VERSION_BLD
FILEFLAGSMASK 0x17L

ifdef _DEBUG

FILEFLAGS 0x1L

else

FILEFLAGS 0x0L

endif

FILEOS 0x4L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileVersion", UNITY_VERSION_WIN
VALUE "ProductVersion", UNITY_VERSION_WIN
VALUE "Unity Version", UNITY_VERSION_UNDER_HASH
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

How would I add UNITY_COPYRIGHT as it isn't populated with this code?

Something like this:

#include <windows.h>
#include "UnityConfigureRevision.gen.h"
#include "UnityConfigureVersion.gen.h"
#include "UnityConfigureOther.gen.h"

VS_VERSION_INFO VERSIONINFO
 FILEVERSION UNITY_VERSION_VER,UNITY_VERSION_MAJ,UNITY_VERSION_MIN,UNITY_VERSION_BLD
 PRODUCTVERSION UNITY_VERSION_VER,UNITY_VERSION_MAJ,UNITY_VERSION_MIN,UNITY_VERSION_BLD
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x0L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "FileVersion", UNITY_VERSION_WIN
            VALUE "ProductVersion", UNITY_VERSION_WIN
            VALUE "Unity Version", UNITY_VERSION_UNDER_HASH
            VALUE "LegalCopyright", "RambosRide (c) 2022"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

That section is documented here: https://docs.microsoft.com/en-us/windows/win32/menurc/stringfileinfo-block

1 Like

That's the information I couldn't find I didn't know to look for "StringFileInfo" - Thank you!

8047970--1038581--2022-04-14_7-51-00.jpg

IDK if I'm doing something wrong but if I comment out
FILEVERSION UNITY_VERSION_VER,UNITY_VERSION_MAJ,UNITY_VERSION_MIN,UNITY_VERSION_BLD
On the compiled exe the File Version gets set to 0.0.0.0 and not the FileVersion in StringFileInfo.

In the Screen grab you can see it still shows unity FILEVERSION, not MY_VERSION

I can override the FILEVERSION values but would have thought the StringFileInfo:FileVersion would populate that field.

Unity version 2020.3.25f1

I think those are two separate properties, and Properties dialog only shows one of them. If you used a tool that showed full information, you'd probably see both. You'll have to change FILEVERSION if you want it to show up in the Properties dialog.

1 Like

Thanks for confirming the issue.

I will modify the FILEVERSION as suggested.

I really appreciate the help!

When we went to 2021.3.4 the windowsstandalone visual studio sln project was changed (still using VS2019)
When I compile now the ProductVersion displaying odd character, in code I use the same constant I use for File Version which does display correctly - any ideas? Thanks!

VALUE "FileVersion", UNITY_VERSION_WIN
VALUE "ProductVersion", UNITY_VERSION_WIN

  • please see attached pic.

8470616--1125620--ProductVersionBug.jpg