Windows build fails on Ionic

Hi, I’m working on an Ionic 3 project. When I try to take windows Build, I’m getting the following error message

D:\Project_Sample\platforms\windows\CordovaApp.Windows10.jsproj(61,5): error MSB4019: The imported project “C:\Program Files (x86)\MSBuild\Microsoft\V
isualStudio\v14.0\Microsoft.VisualStudio…Default.props” was not found. Confirm that the path in the declaration is correct, and that the
file exists on disk.
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1

I’ve already installed Visual Studio 2017, Build tools and Windows SDK.

In the error it is showing the MSBuild version as v14.0, but in my system I can able to find only version 15.0. Is there any possibilities to change the version in my project?

cli packages: (C:\Users\akrra\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : android 6.3.0 windows 5.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v9.2.0
npm  : 5.5.1
OS   : Windows 10

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : legacy

What does ionic cordova requirements output?

cordova requirements

Requirements check results for android:

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-23,android-22
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin\gradle

Requirements check results for windows:
Windows OS: installed Windows 10

MSBuild Tools: installed 14.0
Visual Studio: not installed
Required version of Visual Studio not found. Please install Visual Studio 2015 Community from Download Visual Studio Tools - Install Free for Windows, Mac, Linux

Windows SDK: installed 10.0
Windows Phone SDK: installed 10.0
Error: Some of requirements check failed

Pretty clear what to do.

I downloaded visual studio 2015 community and installed. But now I got a new error as below

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(912,5): error APPX1639: File ‘MakePri.exe’ no
t found. See http://go.microsoft.com/fwlink/?LinkID=798187 for more information.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2202,5): error AP
PX0002: Task ‘SignAppxPackage’ failed. The specified executable is not a valid application for this OS platform.

What to do with this error?

Hi,

After installed visual studio community, I’ve faced some issues like Makepri.exe not found, Makeappx.exe not found etc… After fixing all the things, finally I’m facing an error like the following. I’m clueless that what it is. Please suggest a way to do

PS D:\ionic3\Myapp> cordova run windows -- --arch="x64"
Building project: D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj
        Configuration : debug
        Platform      : x64
  Patching 10 in prebuild event...
  Injected base.js reference to the /www/index.html
  Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.WinJS.2.0\/js\/base.js">\s*<\/script>)(\s*)/ from /www/index.html
  Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.Phone.WinJS.2.1\/js\/base.js">\s*<\/script>)(\s*)/ from /www/index.htm
  l
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error APPX0002: Task 'ValidateAppxMa
nifest' failed. Retrieving the COM class factory for component with CLSID {5842A140-FF9F-4166-8F5C-62F5B7B0C781} failed due to the following error:
 800700c1  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1).\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error APPX0002:  [D:\ionic3\Myapp\pla
tforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018: The "ValidateAppxMani
fest" task failed unexpectedly.\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018: System.BadImageFormat
Exception: Retrieving the COM class factory for component with CLSID {5842A140-FF9F-4166-8F5C-62F5B7B0C781} failed due to the following error: 8007
00c1  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1).\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018:    at Microsoft.Build
.AppxPackage.ValidateAppxManifest.SdkValidation()\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018:    at Microsoft.Build
.AppxPackage.ValidateAppxManifest.ExecuteImplementation()\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018:    at Microsoft.Build
.AppxPackage.AppxPackagingTaskHelper.Execute()\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018:    at Microsoft.Build
.AppxPackage.ValidateAppxManifest.Execute()\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018:    at Microsoft.Build
.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1697,5): error MSB4018:    at Microsoft.Build
.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [D:\ionic3\Myapp\platforms\windows\CordovaApp.Windows10.jsproj]
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1