Did someone tried ionic platform add windows?

We can do ‘ios’ and ‘android’.

I just tried ‘windows’, but got this output:

C:\...\project>ionic platform add windows
Adding windows project...
Creating Cordova Windows Project:
        App Name  : Nexus Ionic
        Namespace : io.ionic.starter
        Path      : C:\...\project\platforms\windows
Installing "cordova-plugin-camera" for windows
Installing "cordova-plugin-datepicker" for windows
Installing "cordova-plugin-device" for windows
Installing "cordova-plugin-file" for windows

The Android Persistent storage location now defaults to "Internal". Please check
 this plugins README to see if you application needs any changes in its config.x
ml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "Android
PersistentFileLocation" you may need to add:

      "<preference name="AndroidPersistentFileLocation" value="Compatibility" />
"

to config.xml in order for the application to find previously stored files.


Installing "cordova-plugin-globalization" for windows
Installing "cordova-plugin-splashscreen" for windows
Installing "cordova-plugin-statusbar" for windows
Installing "cordova-plugin-whitelist" for windows
Installing "cordova-plugin-x-toast" for windows
Installing "cordova-sqlite-storage" for windows
Installing "phonegap-plugin-barcodescanner" for windows
Error: Unexpected end of input

This is normal and the CLI is not ready yet or do you know why I am getting that very vague error?

Hi, you could try to add manually this tag in the config.xml

greetings

 <platform name="windows">
     <preference name="windows-target-version" value="10.0"/>
   </platform>

Hi @jmbc,

Thanks for the suggestion. I tried to add and then ran “ionic run windows” and after lots of lines, it ends with an error

Building project: C:\...\IonicApp\platforms\windows\CordovaApp.Windows
10.jsproj
        Configuration : debug
        Platform      : anycpu
Reader.cs(93,20): error CS0012: The type 'IAsyncOperation<>' is defined in an as
sembly that is not referenced. You must add a reference to assembly 'Windows, Ve
rsion=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=Windows
Runtime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src\
windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(145,13): error CS0012: The type 'IAsyncAction' is defined in an assemb
ly that is not referenced. You must add a reference to assembly 'Windows, Versio
n=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRunt
ime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src\wind
ows\lib\WinRTBarcodeReader.csproj]
Reader.cs(145,13): error CS0012: The type 'IAsyncActionWithProgress<>' is define
d in an assembly that is not referenced. You must add a reference to assembly 'W
indows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentTy
pe=WindowsRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodesc
anner\src\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(145,13): error CS0012: The type 'IAsyncOperation<>' is defined in an a
ssembly that is not referenced. You must add a reference to assembly 'Windows, V
ersion=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=Window
sRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src
\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(145,13): error CS0012: The type 'IAsyncOperationWithProgress<,>' is de
fined in an assembly that is not referenced. You must add a reference to assembl
y 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, Conte
ntType=WindowsRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barco
descanner\src\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(146,13): error CS0012: The type 'IAsyncAction' is defined in an assemb
ly that is not referenced. You must add a reference to assembly 'Windows, Versio
n=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRunt
ime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src\wind
ows\lib\WinRTBarcodeReader.csproj]
Reader.cs(146,13): error CS0012: The type 'IAsyncActionWithProgress<>' is define
d in an assembly that is not referenced. You must add a reference to assembly 'W
indows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentTy
pe=WindowsRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodesc
anner\src\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(146,13): error CS0012: The type 'IAsyncOperation<>' is defined in an a
ssembly that is not referenced. You must add a reference to assembly 'Windows, V
ersion=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=Window
sRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src
\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(146,13): error CS0012: The type 'IAsyncOperationWithProgress<,>' is de
fined in an assembly that is not referenced. You must add a reference to assembl
y 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, Conte
ntType=WindowsRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barco
descanner\src\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(148,27): error CS0012: The type 'IAsyncAction' is defined in an assemb
ly that is not referenced. You must add a reference to assembly 'Windows, Versio
n=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRunt
ime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src\wind
ows\lib\WinRTBarcodeReader.csproj]
Reader.cs(148,27): error CS0012: The type 'IAsyncActionWithProgress<>' is define
d in an assembly that is not referenced. You must add a reference to assembly 'W
indows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentTy
pe=WindowsRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodesc
anner\src\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(148,27): error CS0012: The type 'IAsyncOperation<>' is defined in an a
ssembly that is not referenced. You must add a reference to assembly 'Windows, V
ersion=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=Window
sRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src
\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(148,27): error CS0012: The type 'IAsyncOperationWithProgress<,>' is de
fined in an assembly that is not referenced. You must add a reference to assembl
y 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, Conte
ntType=WindowsRuntime'. [C:\...\IonicApp\plugins\phonegap-plugin-barco
descanner\src\windows\lib\WinRTBarcodeReader.csproj]
Reader.cs(55,22): warning CS0169: The field 'Reader.barcodeFoundOrCancelled' is
never used [C:\...\IonicApp\plugins\phonegap-plugin-barcodescanner\src
\windows\lib\WinRTBarcodeReader.csproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.ta
rgets(57,5): error MSB8020: The build tools for v120 (Platform Toolset = 'v120')
 cannot be found. To build using the v120 build tools, please install v120 build
 tools.  Alternatively, you may upgrade to the current Visual Studio tools by se
lecting the Project menu or right-click the solution, and then selecting "Retarg
et solution". [C:\...\IonicApp\plugins\cordova-sqlite-storage\src\wind
ows\SQLite3-WinRT\SQLite3\SQLite3.Windows\SQLite3.Windows.vcxproj]
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with
exit code 1

I found adding these 4 entries worked for me:

<preference name="windows-target-version" value="10.0" />
<preference name="windows-phone-target-version" value="10.0" />
<preference name="Windows.Universal-MinVersion" value="10.0.10069.0" />
<preference name="Windows.Universal-MaxVersionTested" value="10.0.10166.0" />
1 Like

Hi @jezswift ,

From the CLI you execute ionic run windows?

Did you install something special from microsoft?

Installed nothing special, just added those entries into the config.xml

from CLI ionic run windows

That’s it, worked for me. Hope it works for you/

but have you successfully executed on a real windows phone or emulator? If it is the emulator, which one?

Yes we’ve built a ‘real’ windows app running on a real windows phone and surface pro.

I take it from your comment you are still having issues?

I have run it on a windows 10 pc and it ran perfectly fine. I had to delete the packages and create a new one on VS Studio 15.

I couldn’t run the emulator but I installed manually in the phone.

from the path :
platforms\windows\AppPackages\CordovaApp.Windows10_0.0.1.0_anycpu_debug_Test

the file :
CordovaApp.Windows10_0.0.1.0_anycpu_debug.appx

directly to the phone an then install.
And it run.

I don’t have windows phone or surface. I will try what @bandito suggested. Probably make more sense

Thanks

Did you try updating Ionic 2 CLI and start a fresh project? I just created a barcode scanner for windows 10 and works just fine…

Dont forget for windows only x86 is supported, so you need to add this parameter before running it on windows ‘–archs=x86’

I had installed following things for developing windows mobile app using ionic framework…

ionic start myApp tabs
cd myApp
ionic platform add windows
ionic build windows

first 3 step are executed without any error and windows platform is also added in myApp directory…


now i execute command “ionic build windows” without changing default code, it throws an error as below

If I run ionic run windows --device it installs onto my PC and opens the app as a desktop application (but shows a white screen and doesn’t work). How do I make it run on the Windows Phone device I have plugged in?