Build windows app on ionic with visual studio

i am used vs code for ionic and i have add platform from command line using ionic command, once it will done then i am import windows platform folder in visual studio then i have to try to build the app for windows but i am getting error,

Once i have add windows platform then i will import windows folder in visual studio, but i am not able to build app for windows,

Please help me

ionic cordova build windows doesn’t work?

As Ionic uses Cordova for the platform builds, this should help: https://cordova.apache.org/docs/en/7.x/guide/platforms/win8/index.html

Thanks for the updates, but it’s not work.
Error:

E:\Ionic Data\IONIC2\GetToGetherAPI>cordova build windows -- --appx=8.1-phone
MSBuild v4.0 is not supported, aborting.
Error: AppPackages doesn't exists

What does cordova requirements return?
What is your ionic info output?

E:\Ionic Data\IONIC2\GetToGetherAPI>ionic info
ionic info

Your system information:

cordova CLI: 6.5.0
Ionic Framework Version: 3.2.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
Xcode version: Not installed

You will have to use an older docs version for Cordova then:
https://cordova.apache.org/docs/en/6.x/guide/platforms/win8/index.html
(Or you should upgrade Cordova to 7.x)

This will also unfortunately cause problems, indirectly, as it doesn’t return all the info in ionic info I need. You might want to update that.

Also post the output of ionic platform list please.

You will have to use an older docs version for Cordova then:
https://cordova.apache.org/docs/en/6.x/guide/platforms/win8/index.html
(Or you should upgrade Cordova to 7.x)

Ans :
Ok will update cordova version.

Installed platforms:

android 6.1.2
ios 4.3.1
windows 4.4.3
Available platforms:
amazon-fireos ~3.6.3 (deprecated)
blackberry10 ~3.8.0
browser ~4.1.0
firefoxos ~3.6.3
webos ~3.7.0
wp8 ~3.8.2 (deprecated)

Yep, with Cordova 7 you will also get a newer cordova-windows version that will hopefully be compatible with your local Visual Studio.

Please also post your cordova requirements output I asked for in my first reply.
(Now and after uprgading Cordova)

Ok,
E:\Ionic Data\IONIC2\GetToGetherAPI>cordova requirements

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-19,android-21,android-22,android-23,android-25,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed

Requirements check results for ios:
Apple OS X: not installed
Cordova tooling for iOS requires Apple OS X

Requirements check results for windows:
Windows OS: installed Windows 10
MSBuild Tools: not installed
MSBuild tools v.14.0 not found. Please install Visual Studio 2015 Community from https://www.visualstudio.com/downloads/download-visual-studio-vs
Visual Studio: not installed
Required version of Visual Studio not found. Please install Visual Studio 2015 Community from https://www.visualstudio.com/downloads/download-visual-studio-vs
Windows SDK: not installed
Windows SDK not found. Ensure that you have installed Windows 10.0 SDK along with Visual Studio or install Windows 10.0 SDK separately from https://dev.windows.com/en-us/downloads
Windows Phone SDK: not installed
Windows Phone SDK not found. Ensure that you have installed Windows Phone 10.0 SDK along with Visual Studio or install Windows Phone 10.0 SDK separately from https://dev.windows.com/develop/download-phone-sdk
Error: Some of requirements check failed
1 Like

hello i have update the cordova version,

E:\Ionic Data\IONIC2\GetToGetherAPI>ionic info

Your system information:

cordova CLI: 7.0.1
Ionic Framework Version: 3.2.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
Xcode version: Not installed

That is better.

Now remove and re-add the windows platform: ionic platform remove windows, ionic platform add windows so it is updated. Then run ionic platform list again to confirm that it is now newer.

When you now run cordova requirements then it should give you instructions what to do.

1 Like

actually i don’t know cordova requirements

Just run cordova requirements again on the command line.

1 Like

Ok, i got it cordova requirement for windows:

E:\Ionic Data\IONIC2\myApp>cordova requirements

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-19,android-21,android-22,android-23,android-25,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed

Requirements check results for ios:
Apple OS X: not installed
Cordova tooling for iOS requires Apple OS X

Requirements check results for windows:
Windows OS: installed Windows 10
MSBuild Tools: not installed
MSBuild tools v.12.0 not found. Please install Visual Studio 2013 Express for Windows Update2 from https://www.visualstudio.com/downloads/download-visual-studio-vs
Visual Studio: not installed
Required version of Visual Studio not found. Please install Visual Studio 2013 Express for Windows Update2 from https://www.visualstudio.com/downloads/download-visual-studio-vs
Windows SDK: not installed
Windows SDK not found. Ensure that you have installed Windows 8.1 SDK along with Visual Studio or install Windows 8.1 SDK separately from https://dev.windows.com/en-us/downloads
Windows Phone SDK: not installed
Windows Phone SDK not found. Ensure that you have installed Windows Phone 8.1 SDK along with Visual Studio or install Windows Phone 8.1 SDK separately from https://dev.windows.com/develop/download-phone-sdk
Error: Some of requirements check failed

When i am import windows platform folder in visual studio and try to build it ,it will give error

Error 1 The command “node “E:\Sachchi\windows\\cordova\prebuild-81.js”” exited with code 9009. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets 1131 5 CordovaApp.Windows

Error 102 The command “node “E:\Sachchi\windows\\cordova\prebuild-phone-81.js”” exited with code 9009. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets 1131 5 CordovaApp.Phone

This doesn’t look like the most recent cordova-windows version. You have to remove and re-add the platform, as I wrote above.

Do that, then post your ionic info and cordova requirements again to check. Only when this is done and cordove requirements doesn’t complain about missing stuff again, this can work.

Solution here: