Cordova build windows on Windows 10 and VisualStudio 2017 - windows

Trying to build the Cordova App on Windows 10 always fails with
(node:31) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): No valid MSBuild was detected for the selected target.
on Windows 10 Pro 1709 with VisualStudio 2017 Community Edition.
I exactly followed all instructions for Windows 10 in the cordova docs for windows
I have installed VS with package Mobile Development with Javascript which includes the cordova tools. I also installed the additional Build Tools for Visual Studio 2017.
To create the test app, I used the commands from the docs:
cordova create test
cd test
cordova platform add windows
cordova build windows
After hours of research, I found out the issue could be an active WindowsPolicy DisableRegistryTools, but this is not causing the issue. Reinstalling VisualStudio does also not have any effect. The error message is always the same.
Edit:
I just checked cordova requirements, I did not know that command before. This is the output:
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
If it is possible, I would try the required older version of VisualStudio. But the download is not available anymore.

I finally got cordova build windows and cordova run windows working by following this recently posted guide on the cordova blog.
Install VistualStudio Community 2017 or better
With options:
Universal Windows Platform development,
+add optional: Windows 10 Mobile-Emulator (Fall Creators Update)
+add optional: Windows 10 SDK (10.0.15063.0) für UWP: C#, VB, JS
+add optional: Windows 10 SDK (10.0.10586.0)
Mobile development with JavaScript
+add optional: Windows 10 Mobile-Emulator (Fall Creators Update)
+add optinoal: UWP-Tools for Cordova
Install Build Tools for Visual Studio 2017, you will find them on the VS downloads page in Other Tools and Frameworks section
The options below might not all be necessary, but I installed them all to get it just running.
With options:
Visual C++ Buildtools
+add optional: Windows 10 SDK (10.0.16299.0) für Desktop C++
+add optional: Visual C++-Tools für CMake
Buildtools for web development
+add optional: Development tools für .NET Framework 4–4.6
+add optional: .NET Core 2.0-Development tools
+add optional: NuGet-Ziele und Buildaufgaben
+add optional: TypeScript 2.6 SDK
+add optional: Extended ASP.NET-Features
.NET Core-Buildtools
Node.js Buildtools
Make sure to use cordova platform add windows#6.0.0
otherwise 5.0.0 will be added to your project, which is mostly incompatible to VisualStudio 2017.
Make sure to set MSBUILDDIR to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
Make sure to NOT use bash on Windows, otherwise Cordova will not recognize you are on a Windows operating system. So you have to use CMD or Powershell.
I also added these preferences to the config.xml
<platform name="windows">
<preference name="windows-target-version" value="10.0" />
<preference name="windows-phone-target-version" value="10.0" />
<preference name="WindowsDefaultUriPrefix" value="ms-appx://" />
</platform>
- If you still run into errors, try opening the project in Visual Studio and build there.
If you are using Ionic 3, you can use bash to run npm install, ionic cordova platform add windows#6.0.0 and ionic cordova build windows --prod to compile and copy to platform/www. But building the .appx package must be done with CMD using cordova build windows or cordova run windows
If the App style remains Android-like, add this config to app.module.ts
imports: [
IonicModule.forRoot(MyApp, {
mode: 'wp',
})
],

Related

could not locate Android SDK path in visual studio enterprise 2015

Installed v 2015 enterprise edition.
Downloaded JDK ver 9.1 version for 64 bit.
Have files in this path C:\Program Files (x86)\Android\android-sdk\ for Android SDK.
Even after added that SDK path, it shows build a error as
Xamarin.Android for Visual Studio requires Android SDK. Please install it or set Android SDK path on Tools->Options->Xamarin->Android Settings menu.
Screeshot for adding sdk and JDK:

Visual Studio Build for windowsphone error : (XapDeployCmd.exe) didn't found

I build and emulate my cordova app in android device and VisualStudio Android Emulator successfully in Visual Studio.
But when I try to build and deploy my app to windowsphone device I got this error that said the file "XapDeployCmd.exe" does not in %PATH%
ERROR: Error executing ""XapDeployCmd" /enumeratedevices":
'"XapDeployCmd"' is not recognized as an internal or external command,
WARNING: XapDeploy tool (XapDeployCmd.exe) didn't found. Assume that it's in
%PATH% and deploy fails.
When I referred to the path that I must find the file "XapDeployCmd.exe" in "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\XAP Deployment" I saw there is one file there: "XapDeploy.exe" and "XapDeployCmd.exe" is not there
so where is "XapDeployCmd.exe" ?
I'm using Visual Studio 2015 Community With Update 3 and I installed Windows Phone SDK 8.0
Tools for Apache Cordova only supports deploying to Windows devices 8.1.
To deploy to Windows 8, you need Visual Studio 2013 which has a completely different project structure, and I don't recommend using it.
Most users who are on a version of Windows 8 tend to be on version 8.1
As I stated before، I had installed Windows Phone SDK 8.0 .
with installing Windows Phone SDK 8.0 , Visual Studio 2012 will be installed.
But the file "XapDeployCmd.exe" is not with this version of visual studio.
Installing Update 5 (update 2 or later) of visual studio 2012 will install "XapDeployCmd.exe" with itself. Visual Studio 2012 Iso and problem will be solved.
after solving this problem if you encounter with error like 'Exception from HRESULT: 0x89721800' , refer to this article

Error building sample driver: An SDK corresponding to WDK version '8.1' was not found

I used one Windows Driver samples from github (Filesys) and tried to build it on Windows 10 with Visual Studio 2015.
I have installed both:
WDK8.1 with its SDK
WDK10
But when i try to build a project i see this error message:
An SDK corresponding to WDK version '8.1' was not found. Please install the SDK before building. minispy (Filter\minispy) C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets
but SDK of 8.1 is already installed.
Is there any option in Visual studio that i could use to point it to SDK 8.1?
I had the same problem and the solution
is sdk version 10 released after VS 2015 .
You should download and install it manually. I used the following link for downloading sdk :
https://dev.windows.com/en-us/downloads/windows-10-sdk
Also see this link for help with downloading and installing sdk
http://blogs.msdn.com/b/jpwdkblog/archive/2015/08/21/windows-10.aspx
good luck
In this case, you may missed No.3.
Check following points:
Install Visual Studio 2015
Install Visual C++ (Not installed by default)
Install Windows SDK for Windows 10 (Not installed by default)
Install WDK 10 (Download separately)
Upgrade project from WDK 8.1 (for more detail: https://msdn.microsoft.com/en-us/library/windows/hardware/mt270257%28v=vs.85%29.aspx )
Currently,
Visual Studio 2015 supports WDK 10.
Visual Studio 2013 supports WDK 8.1.
In my environment, Visual Studio 2015 may not support WDK 8.1.
When build in WindowsUserModeDriver8.1 with VS2015, an error was occurred: prop is not found.
WDK 10 supports build drivers for Windows 10 / 8.1 / 8 (/ 7?).
(see also: https://msdn.microsoft.com/en-US/library/windows/hardware/dn914754%28v=vs.85%29.aspx )
To build Windows 8.1 driver, follow below.
Open project properties
Navigate to Configuration Properties > General
Check: Platform Toolset Windows****ModeDriver10.0
Navigate to Configuration Properties > Driver settings
Check: Target OS Version: Windows 8.1
Check: Target Platform: Desktop (Default: Universal)
You are likely targeting the wrong platform toolset. To build a driver for Windows 10, you need to target one of the Windows 10 platform toolset (WindowsKernelModeDriver10.0 or WindowsUserModeDriver10.0). If you want to use SDK 8.1, then you should use the WDK 8.1 platform toolsets (WindowsKernelModeDriver8.1 or WindowsUserModeDriver8.1).
You cannot use the 10.0 toolsets and try to make them point to SDK 8.1 because there were some key changes to how files are laid on disk between the two kits. Using the appropriate toolset should hopefully fix the issue!
Have you followed all the instructions during the installation of VS? https://msdn.microsoft.com/en-us/windows/hardware/dn913721.aspx
After correct installation I have handled the problem.
(Optional)
Did you install Windows 10 SDK?
Download link: https://dev.windows.com/en-us/downloads/windows-10-sdk

error MSB3411: Could not l oad the Visual C++ component "VCBuild.exe"

I have Visual Studio 2010 with SP1 and Windows sdk 7.1.
I also have VS2012 and Windows kit 8.
when i run Windows SDK 7.1 Command Prompt and run node-gyp build --msvs_version=2010 it gives me error:
error MSB3411: Could not load the Visual C++ component "VCBuild.exe".
If the component is not installed,
either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Fr
amework 3.5, or 2) install Microsoft Visual Studio 2008.
Is it trying to find VCBuild.exe.
I found that vcbuild has been replaced with msbuild.
Is it a valid error ?
I also found that in Windows 7, for .NET 3.5, you just need to turn it on from Control Panel. I have looked at other questions on stackoverflow like here and this.
But issue is that since vcbuild.exe does not exist in system with vs2010 then why does node-gyp is searching for it ? Or am i missing something ?
How do i resolve this error ?
The following has worked for me (as of June 2014), as described in here.
Install free Visual Studio Express 2013 for Windows (not VS Express 2013 for Web)
npm install --msvs_version=2013
Otherwise, I have spent a lot of time installing old Microsoft packages and patches, and it wasn't helpful.
Setting up the VS2010 and other applications as listed at node-gyp wiki solved the problems.
On Windows XP/Vista/7, node-gyp requires Python 2.7 and Visual Studio 2010
According to the readme file in Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1, to ensure that your system has a supported configuration,
uninstall the following products first (if you want to save tons of time)
and then reinstall them in the order listed: (you can uninstall in any order :P)
Visual Studio 2010
Windows SDK 7.1
Visual Studio 2010 SP1
Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
On x64 environments, the last update in the list fixes errors about missing compilers and
error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found.
The answer to all your question lies here. Struggled a lot to find this. Finally got it working. =)
Just to save you time visiting the link here is what's useful in that link.
INSTRUCTIONS:
You can install with npm:
$ npm install -g node-gyp
You will also need to install:
On Unix:
python (v2.7 recommended, v3.x.x is not supported)
make A proper C/C++ compiler toolchain, like GCC
On Windows:
Python (v2.7.3 recommended, v3.x.x is not supported)
Windows XP/Vista/7: Microsoft Visual Studio C++ 2010 (Express version
works well)
For 64-bit builds of node and native modules you will also need the Windows > 7
64-bit SDK
If the install fails,
try uninstalling any C++ 2010 x64&x86 Redistributable that you have
installed first.
If you get errors that the 64-bit compilers are not installed you may
also need the compiler update for the Windows SDK 7.1
Windows 7/8:
Microsoft Visual Studio C++ 2012/13 for Windows Desktop (Express
version works well)
If you have multiple Python versions installed,
you can identify which Python version node-gyp uses by setting the
'--python' variable:
$ node-gyp --python /path/to/python2.7
If node-gyp is called by way of npm and you have multiple versions of
Python installed, then you can set npm's 'python' config key to the
appropriate value:
$ npm config set python /path/to/executable/python2.7
This can be fixed by installing all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated cmd (run as administrator).

visual studio windows phone 7 installation error

I try to install latest Visual Studio Windows Phone Beta Tools and I get following error:
"Setup could not install the following component:
Microsoft .NET Framework 4"
Here is the error log: http://pastebin.com/CRumcpsN . I'm running under Windows 7 32bit.
What I have to do to install Visual Studio Windows Phone Beta Tools?
Try installing the .NET 4 framework first http://www.microsoft.com/downloads/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992&displaylang=en
Are you sure you downloaded the correct WP7DT version? I noticed this in your dump.
dotNetFx40_Full_x86_x64.exe; error = 0x80091007

Resources