Visual Studio 2015 cannot create Release builds for Cordova project - visual-studio

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

Related

Flutter windows app compile cmake error $<TARGET_FILE_DIR:testbed>

I'm actually trying to build a flutter app windows but i got this error message :
flutter build windows
CMake Error:
Error evaluating generator expression:
$<TARGET_FILE_DIR:testbed>
No target "testbed"
CMake Generate step failed. Build files cannot be regenerated correctly.
Building Windows application...
Unable to generate build files
The error was repeated about 20 times.
There is no problem with the flutter doctor -v command :
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.6.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.6.30225.117
• Windows 10 SDK version 10.0.18362.0
If anyone have a solution, thanks to him.
I found where the error came from :
In the .\build\windows\CMakeCache.txt file at line 59 there is this :CMAKE_INSTALL_PREFIX:PATH=$<TARGET_FILE_DIR:testbed>
To solve my error i just need to replace testbed by my project name.
Just go build folder in your flutter project and delete the windows folder and everything will be back to normal

Intel Compiler 18.0 Toolset raises exception with msbuild

I reinstalled my machine and installed Visual Studio 2017, Visual Studio 2019 (Preview) and the Intel Compiler 18. Due to unknown reasons, my projects do not work anymore, and I can't figure out what's causing it. Did anyone ever experience the following error message?
My project uses the Intel C++ Compiler 18.0 toolset.
Visual Studio 2017 error message:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\xmemory0(178):
error : identifier "__STDCPP_DEFAULT_NEW_ALIGNMENT__" is undefined
1> enable_if_t<(!_HAS_ALIGNED_NEW || _Align <=
__STDCPP_DEFAULT_NEW_ALIGNMENT__), int> = 0> inline
Visual Studio 2019 (Preview) error message:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\Intel C++ Compiler 18.0\Toolset.targets(150,5):
error MSB4062: The "ICMessage" task could not be loaded from the assembly C:\Program Files %28x86%29\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Intel.Build.ICLTasks.v150.dll.
Could not load file or assembly 'file:///C:\Program Files %28x86%29\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Intel.Build.ICLTasks.v150.dll' or one of its dependencies.
The system cannot find the file specified.
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.
Before the reinstallation, my project worked fine. Does anyone have an idea what's going on here?
The system cannot find the file specified.
1.Check whether the Intel.Build.ICLTasks.v150.dll exists in the path C:\Program Files (x86)\Microsoft Visual Studio\2017\xxx\Common7\IDE\VC\VCTargets. According to the error message it's not there, so i guess the Intel Compiler 18 was not successfully installed.
Note that recommended order to do the installation is: Install VS successfully and then install Intel Compiler. If you install the Intel Compiler before installing the VS2017, it will cause issues.
e.g: After installing VS, when I install the Intel Parallel Studio, it will download several files and assemblies to folder C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets for future development. So if I install Intel compiler before installing VS, I can't find Intel.Build.ICLTasks.v150.dll there.
2.And for your original error message in VS2017, I suggest you update your Intel Compiler to 2019 Update3 and higher, see versions. When you reinstall VS, the installer will download latest 15.9.16 version(newer than your old version), so you also need to upgrade your Intel compiler version to resolve some conflicts.

Visual Studio Team Services build process cannot find CSharp targets file

I'm trying to set up a build process in Visual Studio Team Services, and I've done so by following the steps for UWP projects using an agent on my box, but I keep getting the following build errors:
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.CSharp.targets(7,3): Error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\10.0.10240.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
I checked out the path the build is complaining about and the problem is in the 10.0.10240.0 in the path:
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\10.0.10240.0\Microsoft.Windows.UI.Xaml.CSharp.targets
The target file is located in
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.CSharp.targets
Here is how the declaration in the project file looks like (I don't think it is erroneous and I don't see where this weird 10.0.10240.0 version comes from in the path):
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
Any suggestions on what could be wrong and how can I fix that?
The Universal Windows Platform was introduced in Windows 10. Visual Studio has support for UWP apps as of Visual Studio 2015. You need to use VS2015 to create a UWP project, and install VS2015 on your build agent machine.

MsBuild with Visual Studio 2012 Package Project

I have created .NET solution with Visual Studio 2012 Package Project (From VS2012 SDK). With Visual Studio I successfully compile and run this project (along with entire solution) in "Debug" configuration mode, and for "Any CPU" platform. But when I try to build solution in command line using MsBuild, I get errors:
Command:
msbuild MySolution.sln /p:Configuration=Debug /p:Platform="Any CPU"
Errors:
error : Can not find the installation for VS SDK.
error MSB4018: The "FindVsSDKInstallation" task fail
ed unexpectedly.
error MSB4018: System.ArgumentNullException: Value can
not be null.
error MSB4018: Parameter name: path1
error MSB4018: at System.IO.Path.Combine(String pat
h1, String path2)
error MSB4028: The "FindVsSDKInstallation" task's ou
tputs could not be retrieved from the "IncludesPath" parameter. Value cannot be
null.
error MSB4028: Parameter name: path1
All activities are performed on my local Windows 7, with VS2012 and SDK installed.
I was looking for solution on the Web and I have found the following topic: FindVsSDKInstallation task fails on the build box. There is said that such a project should be compiled for "x86" platform, because devenv.exe process is 32-bit. So I change a Platform Target property from Project Properties to "x86" (for "Debug" mode). The result is the same - project is built successfully in VS but not in MsBuild.
Why VS2012 Package project is properly built by using VS, but MsBuild fails? How should I run MsBuild to build it successfully?
First, you need to use a visual studio command prompt, or call the vsvars batch file e.g.
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"
Second, the link you gave also says
"I think setting the "VsSDKInstall" environment variable should work
too"
There's a related post here

FxCop - How to resolve Windows, Version 255.255.255.255?

I am trying to get FxCop 10 to run analysis on a Windows 8 build computer and seem to have run up against a wall.
When I run it with /verbose against a dll, I get:
Could not resolve reference to Windows. Could not load [path to my dll]. The following error was encountered while reading module [name of my module]: Assembly reference cannot be resolved: Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null
I have it pointing to the VS 2012 minimum recommended rules and can get it to run code analysis from visual studio if I set the FxCopCmd.exe.config:
Here is my command line version, which produces the error mentioned above:
fxcopcmd /file:"D:\Source\Project\bin\release\myproject.dll" /out:"D:\temp\fxcop-report.xml" /rs:="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Static Analysis Tools\Rule Sets\MinimumRecommendedRules.ruleset" /s /assemblyCompareMode:StrongNameIgnoringVersion /searchgac /verbose
I get prompted for Windows, Version 255.255.255.255 if I try to run analysis using the FxCop application as well.
This is a Windows 8 Phone project.
Try adding this switch to your FxCopCmd command:
/directory:"C:\Program Files (x86)\Windows Phone Kits\8.0\Windows MetaData"
That worked for me when I met the same error running Visual Studio Code Metrics Powertool for Visual Studio 2013 (metrics.exe).

Resources