Ionic cordova build windows throw *MSBUILD* error - visual-studio

When i run ionic cordova build windows it throws error like-
> cordova build windows
ENV var MSBUILDDIR is set C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
Building project: C:\Users\shail\Desktop\ionic-demo\ionic-4-windows\platforms\windows\CordovaApp.Windows10.jsproj
Configuration : debug
Platform : anycpu
Buildflags : /p:AppxBundle=Never
MSBuildTools : C:\Program Files (x86)\MSBuild\14.0\bin
buildProject spawn: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild [ 'C:\\Users\\shail\\Desktop\\ionic-demo\\ionic-4-windows\\platforms\\windows\\CordovaApp.Windows10.jsproj',
'/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',
'/nologo', '/p:Configuration=debug', '/p:Platform=anycpu', '/p:AppxBundle=Never'] { stdio: 'inherit' } C:\Users\shail\Desktop\ionic-demo\ionic-4-windows\platforms\windows\CordovaApp.Windows10.jsproj(61,5): error MSB4019: The imported project "C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Microsoft.VisualStudio..Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild: Command failed with exit code 1
is any one can help to resolve this problem.
ionic -v is 4.12.0
cordove -v is 9.0.0
installed platform
cordova platforn list
Installed platforms:
android 8.0.0
windows 7.0.0
Using Visual Studio 2017 Enterprise

According to the error message: The path of your msbuild tool is
invalid.
1.As for vs2017, the msbuild you use should be C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin instead of C:\Program Files (x86)\MSBuild\14.0\bin.
2.Also, v14.0 is for vs2015 while v15.0 for vs2017, please change all 'v14.0' in your setting to 'v15.0' and run it.

Related

Ionic / Cordova Windows build picking up incorrect MSBUILD path

I have had to do a few update of Visual Studio on my Windows 10 machine (after some licensing issues).
I use to have Visual Studio Enterprise 2017, which I uninstalled. I now have Visual Studio Professional 2017, and Studio Enterprise 2019 (which I recently installed). I also installed Visual Studio Build Tools 2019 (2).
Now, when I try to build my Ionic project via the command I have always used...
ionic cordova build windows --prod --release -- --archs="x86 x64 arm" --buildConfig=platform_build_files\\windows\\build.config
I now get the error...
Building project: D:\dev\myapp\platforms\windows\CordovaApp.Windows10.jsproj
Configuration : release
Platform : x86
Buildflags : /p:AppxBundle=Never,/p:UapAppxPackageBuildMode=StoreUpload
MSBuildTools : C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
buildProject spawn: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild [ 'D:\\dev\\myapp\\platforms\\windows\\CordovaApp.Windows10.jsproj', '/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',
'/nologo',
'/p:Configuration=release',
'/p:Platform=x86',
'/p:AppxBundle=Never',
'/p:UapAppxPackageBuildMode=StoreUpload' ] { stdio: 'inherit' }
The system cannot find the path specified.
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild: Command failed with exit code ENOENT
Of course I no longer have a folder C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise as I uninstalled it.
I have removed and readded the windows platform for my Ionic app, but this did not help.
Also, I am not sure if this is related, but when I try to open the CordovaApp.sln in Visual Studio 2019, I get the following...
Not sure if related.
My question is, how can I reset this MSBuild path? I cannot see any environmental variables anywhere for this, I just can't get rid of this old path
Edit 1
I added the env var as suggested:
Opened a new command prompt, but it is still looking for the non-existent path
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild: Command failed with exit code ENOENT
In Visual Studio 2019, creating UWP apps using Javascript is no longer supported, if you want to build UWP apps using web technologies like Cordova. You need to use Visual Studio 2017.
My question is, how can I reset this MSBuild path?
Visual Studio will choose the version of MSBuild without explicit settings, but you can change this by setting environment variables.
Please add the path of MSBuild to the system environment variable, like:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
Best regards.

Build Failed after adding Kapsel Plugins to Cordova Project - Could not find SDK "Microsoft.VCLibs, Version=12.0"

I'm trying to make a Windows Cordova build using cmd but I'm getting below errors. Can any of you please guide me on how to fix this issue.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(
2377,5): error MSB3774: Could not find SDK "Microsoft.VCLibs, Version=12.0".
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe: Command failed with exit code 1
PS: I'm using Visual Studio Community 2017.

building ionic3 cordova app for windows missing MakePri.exe

I have problems while building > ionic cordova build windows --release
>cordova build windows --release --arch="x64"
Building project: C:_DEV\ionic\5tgf\platforms\windows\CordovaApp.Windows10.jsproj
Configuration : release
Platform : x64
Patching 10 in prebuild event...
C:\Program Files x86)\MSBuild \Microsoft \VisualStudio \v14.0 \AppxPackage \Microsoft.AppXPackage.Targets(912,5): error APP X1639: fichier 'MakePri.exe' introuvable.
See http://go.microsoft.com/fwlink/?LinkID=798187 for more information.
[C:_DEV\ionic\5tgf\platforms\windows\CordovaApp.Windows10.jsproj]
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1}
Link to microsoft is down, tried google without much result.
I ve tried to modify path variable by adding way to MakePri.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
Nothing work .. help me please :)

Visual Studio 2015 cannot create Release builds for Cordova project

I am using Visual Studio 2015 for Cordova Tools to build an app that targets Windows Universal (UWP) and Android.
I can successfully create Debug builds for both Android and UWP, Release build works for Android as well.
However Visual Studio fails to create Release builds for UWP, none of the Windows-AnyCPU, Windows x86, Windows x64 and Windows ARM options works.
When creating Release builds for Windows-AnyCPU, the error message is like:
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(133,5): error MSB3779: The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.NET.Native.Framework.1.2, Version=1.2". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj]
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(133,5): error MSB3779: The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.NET.Native.Runtime.1.1, Version=1.1". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj]
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(248,5): error MSB4062: The "IlcErrorTask" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\ilc.exe. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\ilc.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj]
1>MDAVSCLI : error : Error code 1 for command: C:\Program Files (x86)\MSBuild\14.0\bin\amd64\msbuild with args: C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj,/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal,/nologo,/p:Configuration=release,/p:Platform=anycpu
1> Command finished with error code 2: cmd /s /c ""C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\cordova\build.bat" --release "--buildConfig=C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\build.json" --archs=anycpu --win"
1>ERROR building one of the platforms : error : cmd: Command failed with exit code 2
1> You may not have the required environment or OS to build this project
1>MDAVSCLI : error : cmd: Command failed with exit code 2
When creating Release builds for Windows x86, Windows x64 or Windows ARM, the error message is like:
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(669,5): error MSB4062: The "SharedAssemblyApplicabilityVerifierTask" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj]
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(405,5): error MSB4062: The "ComputeManagedBinaries" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj]
1>MDAVSCLI : error : Error code 1 for command: C:\Program Files (x86)\MSBuild\14.0\bin\amd64\msbuild with args: C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj,/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal,/nologo,/p:Configuration=release,/p:Platform=x64
1> Command finished with error code 2: cmd /s /c ""C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\cordova\build.bat" --release "--buildConfig=C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\build.json" --archs=x64 --win"
1>ERROR building one of the platforms : error : cmd: Command failed with exit code 2
1> You may not have the required environment or OS to build this project
1>MDAVSCLI : error : cmd: Command failed with exit code 2
What confuses me is that all of these 4 configurations works fine with Debug builds.
Moreover, Visual Studio stops working when I try to associate the app with the Windows Store.
I am using:
Visual Studio Community 2015 Version 14.0.24720.00 Update 1
Visual Studio Tools for Apache Cordova 14.0.51016.1
Cordova CLI version
5.4.1
I've tried reinstalling Visual Studio, but it didn't work.
Thanks.
I spent hours struggling with this and was able to solve it finally by uninstalling Node 64 bit and installing 32 bit.
You can specify the architecture and the platform you want to build the Windows app in.
cordova build --release windows --appx=[platform] --archs=[architecture]
Options:
Platform: 8.1-win, 8.1-phone, uap
Architecture: x86, x64, arm
For Example:
cordova build --release windows --appx=uap --archs=arm
Reference: https://cordova.apache.org/docs/en/latest/guide/platforms/win8/
Visual Studio stops working when I try to associate the app with the Windows Store.
This is a bug that has just been fixed in Visual Studio 2015 Update 2. Here's a link to the installer: http://go.microsoft.com/fwlink/?LinkId=691129

Xamarin Studio Build Error File 'Windows.Props' not found

I just downloaded Xamarin studio but when I try to compile the code it gets this error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\
Microsoft.AppXPackage.Targets(9,9):
Error APPX1639: File 'Windows.props' not found.
See http://go.microsoft.com/fwlink/?prd=12395&pver=1.0&plcid=0x409&ar=MSDN&sar=PlatformMultiTargeting&o1=
C:\Program Files (x86)\Microsoft SDKs\Portable\v12.0&o2=Portable for more information. (APPX1639) (ToDo)
I already installed the sdk for Windows 10, and tried to repair the app but nothing happened.

Resources