Search Unity

Unity 2019.3 Build & Run UWP MSBuild error

Discussion in 'Windows' started by beetrootSOUP, May 29, 2019.

  1. beetrootSOUP

    beetrootSOUP

    Joined:
    Sep 23, 2014
    Posts:
    3
    Hi
    I created unity UWP IL2CPP (.net 4.x compatibility) and I'm trying to get 'Build and Run' working. Unfortunately every time I get result that build was successful but after that got error:

    Exception: Failed to locate suitable MSBuild 'C:\Program Files (x86)\MSBuild\16.1\Bin\MSBuild.exe'
    Utility.GetMSBuildExePath (Utility+VisualStudio vs) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/Utility.cs:834)
    ApplicationLauncherImpl.RunMSBuild (System.String args, Utility+VisualStudio vs) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:259)
    ApplicationLauncherImpl.Build (Utility+VisualStudio vs) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:143)


    I have latest Visual Studio 2019 installed along with unity dev tools. I can open generated solution and build it in VS but would prefer streamline the process.
    Did anyone had similar issue?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    This is a bug in Unity - looks like our code looks in incorrect directory for MSBuild.exe when you have VS 2019 installed. Can we get a bug report?

    You should be able to work around the bug by making a copy of "C:\Program Files (x86)\MSBuild\16.0" folder and naming it "C:\Program Files (x86)\MSBuild\16.1".
     
  3. beetrootSOUP

    beetrootSOUP

    Joined:
    Sep 23, 2014
    Posts:
    3
    Weirdly there is no msbuild/16.0. I did the system wide search for MSBuild.exe and found several different ones:
    - one for each version of .net framework (in C:\Windows\Microsoft.NET\Framework)
    - and in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin

    I've made a copy of the one from VS folder but then got different error message:

    error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\16.1\Bin\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    ld (Utility+VisualStudio vs) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:143)
    ApplicationLauncher.BuildAndRunProject (UnityEditor.Modules.BuildLaunchPlayerArgs args, UnityEditor.WSABuildAndRunDeployTarget deployTarget, System.String platform, Utility+VisualStudio vs) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:66)
    ApplicationLauncher.BuildAndRun (UnityEditor.Modules.BuildLaunchPlayerArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:38)
    UnityEditor.UWP.BuildPostprocessor.LaunchPlayer (UnityEditor.Modules.BuildLaunchPlayerArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:83)
    UnityEditor.PostprocessBuildPlayer.Launch (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget buildTarget, System.String path, System.String productName, UnityEditor.BuildOptions options, UnityEditor.Build.Reporting.BuildReport buildReport) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:166)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()


    I can report a bug in Unit for the first issue which was pointing to non existing MSBuild folder.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    Ouch. Do you only have VS2019 installed? If you changed VS version in Build Window to VS 2017, it would use older MSBuild which is known to work.

    Let me know the bug # once you report it so I can accelerate its investigation.
     
  5. beetrootSOUP

    beetrootSOUP

    Joined:
    Sep 23, 2014
    Posts:
    3
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    Yeah I understand that it's not ideal. Thanks for the report, we'll fix it.
     
  7. Soundguy

    Soundguy

    Joined:
    Oct 30, 2009
    Posts:
    28
    I"m encountaring the same bug in Unity 2018.4.1 should i file a report as well?
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    No need for that, we're tracking it. I hope to get to it soon.
     
  9. ImperialDynamics

    ImperialDynamics

    Joined:
    Jun 21, 2018
    Posts:
    14
    same issue here. Any update yet?!
     
    thegary likes this.
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    It got fixed a couple weeks ago and it's making its way to Unity releases.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    The fix landed to 2019.2.6f1, and is on its way to Unity 2018.4.