0

When I'm trying to run ionic build windows --release I get the following error:

[16:20:53]  lint finished in 4.71 s
The following image was skipped because it has an unsupported size (undefinedxundefined): resources\android\icon\drawable-xhdpi-icon.png


Building project: C:\Users\Ivar\Documents\earthinks\platforms\windows\CordovaApp.Windows10.jsproj

        Configuration : release
        Platform      : arm

C:\Users\Ivar\Documents\earthinks\platforms\windows\
    CordovaApp.Windows10.jsproj(61,13): error MSB4226: The imported project 
    "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\JavaScript\Microsoft.VisualStudio.WJProject.Default.props" 
    was not found. Also, tried to find "Microsoft\VisualStudio\v15.0\JavaScript\Microsoft.VisualStudio.WJProject.Default.props" 
    in the fallback search path(s) for $(MSBuildExtensionsPath32) - "C:\Program Files (x86)\MSBuild" . 
    These search paths are defined in "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe.Config". 
    Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.

Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe: Command failed with exit code 1

Now I have installed the Visual Studio 2017 Build Tools.

I checked for the missing file and my folder C:\Program Files (x85)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\ only contains CodeAnalysis and WebApplications.

I first ran into a common error of not having any build tools at all. So I downloaded them, and this question (Cordova project and windows platform) said that I should add VSINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\ to my environment variables.

Now my C:\Program Files (x86)\Microsoft Visual Studio\2017 only contains BuildTools. So I added the environment variable:

VSINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools (BuildTools does contain the MSBuild folder (and does contain a JavaScript folder which doesn't contain Microsoft.VisualStudio.WJProject.Default.props))

Searching for Microsoft.VisualStudio.WJProject.Default.props in the Microsoft Visual Studio folder gave no results at all.

Ivar Reukers
  • 7,560
  • 9
  • 56
  • 99

1 Answers1

2

ionic build windows --release throws error

That because you are missing the "Microsoft.VisualStudio.WJProject" workload. I have ever troubleshooting the same issue, after test and searched, I found that Visual Studio installed something that we did not installed with build tools. Even if we could copy the MSBuild folder from machine which installed Visual Studio 2017, we may get more of the other extension error.

Besides, other community mentioned here:

Develop an Ionic app for Windows without using Visual Studio does not make much sense, because with Visual Studio you can debug and work on plugins and other stuffs.

Obviously, the best way to build the Ionic app for Windows is to install Visual Studio 2017. If you want make it work without Visual Studio, it sometimes a lot of work to figure out. You'll need to install the right Windows / .NET Platform SDK. You can install multiple of these SDKs side by side. You might need to install further SDKs to get your application to compile. The downloads for these all assume that you also have Visual Studio installed, but many of their payloads can also be installed separately. It can become quite a hassle.

Community
  • 1
  • 1
Leo Liu
  • 71,098
  • 10
  • 114
  • 135