ERROR: MSBuild v4.0 ist not supported, aborting


#1

Hello,

I’m trying to create an app for Windows. If I enter “ionic cordova run windows” comes the error “MSBuild v4.0 is not supported, aborting.” .If I download the “Windows Build Tools”, there is a folder “14.0” under “MSBuild” next to the “15.0” and “Microsoft”, which invokes a different error:

Building project: C:\Users\TStrohschnieder.HANSA\WebAppInonic\platforms\windows\CordovaApp.Windows.jsproj

    Configuration : debug
    Platform      : anycpu

C:\Users\TStrohschnieder.HANSA\WebAppInonic\platforms\windows\CordovaApp.Windows.jsproj(70,3): error MSB4019: Das importierte Projekt “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript\Microsoft.TypeScript.Default.props” wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der -Deklaration korrekt und die Datei auf dem Datenträger vorhanden ist.
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1
[ERROR] An error occurred while running cordova run windows (exit cod"e 1).

Please - help me - I am looking for hours fot the solution


#2

Did you install Visual Studio 2015 Community?

What is your ionic info output?


#3

@Sujan12 i have VS 2017 Community installed.

Ionic Info:

cli packages: (C:\Users\TStrohschnieder.HANSA\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.8.1
ionic (Ionic CLI) : 3.8.1

System:

Node : v6.11.2
npm  : 3.10.10
OS   : Windows 10

#4

Read the error message. It tells you to install VS 2015 Community. Do what it says. It will solve your problem.


#5

But it must also work with visual studio 2017. It only requires the MSBuild tool. If I download MSBuild 2015, it throws the second error above. :crazy_face: :confounded:


#6

Well, then good luck. The error message and my own experience says otherwise.

What second error?


#7

The First:

“MSBuild v4.0 is not supported, aborting.”

The Second:

Building project: C:\Users\TStrohschnieder.HANSA\WebAppInonic\platforms\windows\CordovaApp.Windows.jsproj

Configuration : debug
Platform      : anycpu

C:\Users\TStrohschnieder.HANSA\WebAppInonic\platforms\windows\CordovaApp.Windows.jsproj(70,3): error MSB4019: Das importierte Projekt “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript\Microsoft.TypeScript.Default.props” wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der -Deklaration korrekt und die Datei auf dem Datenträger vorhanden ist.
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1
[ERROR] An error occurred while running cordova run windows (exit cod"e 1).te

I have, maybe, found a solution. Have you ever changed the path under [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ MSBuild \ ToolsVersions \ 15.0]?


#8

Please create a second topic for the second error message. Mixing these is too confusing (at least for me).

No, I just installed both Visual Studio versions.


#9

This is fixed, follow the bellow steps

  1. cd ionic app dir.
  2. ionic cordova platform add windows
  3. ionic prepare platform windows
  4. Add below section in config.xml
<platform name="windows">
        <preference name="windows-target-version" value="10.0" />
    </platform>
  1. open the ’ CordovaApp.sln ’ from appdir/platforms/windows/ in VS 2013/2015/2017 [Assuming you have the Visual studio set up for cordova build]
  2. build it from VS

#10

This doesn’t fix the issue, yes you can still build from VS in the generated .sln but it makes building/deploying a major pain.

If you run cordova run windows it still throws the MSBuild v4.0 error.

I have both VS 2015 and VS 2017 installed and the target version set.

If it’s just accepted that cordova run windows doesn’t work, remove it…


#11

I decided to try running cordova run windows --verbose and lucked out seeing what it was doing:

Running command: C:\WINDOWS\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.5 /v MSBuildToolsPath
Running command: C:\WINDOWS\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0 /v MSBuildToolsPath
Running command: C:\WINDOWS\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 /v MSBuildToolsPath
Running command: C:\WINDOWS\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0 /v MSBuildToolsPath
Running command: C:\WINDOWS\system32\reg.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 /v MSBuildToolsPathSkip!
Command finished with error code 1: C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0,/v,MSBuildToolsPath
Command finished with error code 1: C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0,/v,MSBuildToolsPath
Command finished with error code 1: C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0,/v,MSBuildToolsPath
Command finished with error code 1: C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.5,/v,MSBuildToolsPath
Command finished with error code 0: C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0,/v,MSBuildToolsPath
Found MSBuild v4.0 at C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
Using MSBuild v4.0 from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\

So it is indeed something with the registery/msBuild path… tracking down resolution…