Search Unity

Windows standalone custom .exe manifest

Discussion in 'Windows' started by bceyetech, Sep 19, 2020.

  1. bceyetech

    bceyetech

    Joined:
    Dec 12, 2019
    Posts:
    8
    I am trying to build a Windows executable with higher level privileges, but I cannot figure out how to update the assembly info to allow for a custom manifest. The assembly info in the .exe is only at a level="asInvoker" but I need it to be level="highestAvailable".

    Is there a way to do this through the editor or Visual Studio? Any suggestions are greatly appreciated. Thanks in advance!
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I assume you're just rebuilding the Windows executable located at "<EDITOR_INSTALL_DIR>\Data\PlaybackEngines\windowsstandalonesupport\Source\WindowsPlayer"? The setting in question is located inside WindowsPlayer.manifest file.
     
    bceyetech likes this.
  3. bceyetech

    bceyetech

    Joined:
    Dec 12, 2019
    Posts:
    8
    Thanks, that looks like it! Though, when I replace "asInvoker" with "highestAvailable" in the WindowsPlayer.manifest, save the manifest, and rebuild the project, the executable still has a requested execution level of "asInvoker". The manifest still says "highestAvailable".

    What is the correct procedure to get the updated manifest into the Windows standalone builds?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Did you recompile the Visual Studio project in there? Unity doesn't actually build or touch that project: we use precompiled binaries. You need to manually copy the .exe file that was produced by the Visual Studio project to your build output folder.
     
    bceyetech likes this.
  5. bceyetech

    bceyetech

    Joined:
    Dec 12, 2019
    Posts:
    8
    Are you talking about the "Create Visual Studio Solution" option?
     
  6. bceyetech

    bceyetech

    Joined:
    Dec 12, 2019
    Posts:
    8
    Great, this works! Thank you so much!

    For anyone else that runs across this issue, steps to update the manifest:
    1. Check the option to "Create Visual Studio Solution" and build your Unity project.
    2. Update manifest at <UnityProject>/<VS Solution>/<ProjectName>/WindowsPlayer.manifest
    3. Rebuild the Visual Studio solution
    4. Copy the <VS Solution>/<ProjectName>/<ProjectName>.exe produced by VS to your Unity Build folder, replacing the existing <ProjectName>.exe
     
  7. unity_98B5F44ABDE897D859F4

    unity_98B5F44ABDE897D859F4

    Joined:
    Aug 1, 2022
    Posts:
    5
    Thanks a lot, but to make sure I understand:
    We need to build once with "Create Visual Studio Solution" unchecked, AND once with it checked?
    And after doing the work you described, we paste the .exe into the Unity Build folder that was created initially?
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Building with Create Visual Studio solution is just a convenient way to get a Visual Studio project to make the game executable. So if you normally do not use that option, you only need to build the executable once and then you can reuse it for practically forever (at least until you upgrade to a new major Unity release, just to be sure).

    If you do use Create Visual Studio solution option as a way to build your game, then that's all you need.