I'm trying to build my cordova application on Windows 10 but it fails because of the selected path i guess. I have Visual Studio 2017 installed and want to select the msbuild path at: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin but the process always uses C:\Program Files (x86)\MSBuild\14.0\Bin for building the application. I am not sure what the problem exactly is if the path is the problem or are there any problems with versions. The application wasn't developed by me so I'm not really familiar with where and why my problem is caused.
I have already tried to change my Windows path variable but it does not affect the build process. Also I switched from Visual Studio 2019 to 2017 because cordova build is not supported anymore.
My CordovaApp.Windows10.jsproj file:
<?xml version='1.0' encoding='utf-8'?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputPath>build\windows\$(Configuration)\$(Platform)\win10\</OutputPath>
<IntermediateOutputPath>build\windows\bld\</IntermediateOutputPath>
<AppxPackageSigningEnabled>true</AppxPackageSigningEnabled>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|AnyCPU">
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|AnyCPU">
<Configuration>Release</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>f9b0ae20-c21c-42b9-9c4e-d8k328b4509e</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(CordovaBundlePlatforms)' != ''" Label="CordovaBuildParameters">
<AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>$(CordovaBundlePlatforms)</AppxBundlePlatforms>
</PropertyGroup>
<Import Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0'">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).props" />
<PropertyGroup>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<UapDefaultAssetScale>100</UapDefaultAssetScale>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' < '14.0'">
<TargetPlatformVersion>10.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0</TargetPlatformMinVersion>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="package.windows10.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<Import Label="Shared" Project="CordovaApp.projitems" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
<Target AfterTargets="ResolveAssemblyReferences" BeforeTargets="AfterResolveReferences" Condition="'$(Platform)' == 'AnyCPU'" Name="DetectMangedWinMDWithAnyCpu">
<Error Condition="'%(_ResolveAssemblyReferenceResolvedFiles.WinMDFile)' == 'true' AND '%(_ResolveAssemblyReferenceResolvedFiles.WinMDFileType)' == 'Managed'" Text="The following component requires .NET Native compilation which is not available when targeting 'Windows10' and 'AnyCPU'. Consider changing the targeted processor architecture to one of the following: 'x86, x64, ARM' (if you are using command line this could be done by adding '--archs' parameter, for example: 'cordova build windows --archs=x64'). %(_ResolveAssemblyReferenceResolvedFiles.Identity)" />
</Target>
<PropertyGroup>
<PreBuildEvent>node "$(ProjectDir)\\cordova\\prebuild-10.js"</PreBuildEvent>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
</Project>
This is my console output:
Building project: C:\Users\Thomas\Desktop\output-win\platforms\windows\CordovaApp.Windows10.jsproj
Configuration : debug
Platform : x86
Buildflags : /p:CordovaBundlePlatforms=x86
MSBuildTools : C:\Program Files (x86)\MSBuild\14.0\bin
buildProject spawn: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild [ 'C:\\Users\\Thomas\\Desktop\\output-win\\platforms\\windows\\CordovaApp.Windows10.jsproj',
'/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',
'/nologo',
'/p:Configuration=debug',
'/p:Platform=x86',
'/p:CordovaBundlePlatforms=x86' ] { stdio: 'inherit' }
C:\Users\Thomas\Desktop\output-win\platforms\windows\CordovaApp.Windows10.jsproj(61,5): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Mi
crosoft\VisualStudio\v14.0\Microsoft.VisualStudio..Default.props" was not found. Make sure that the path in the <Import> declaration is correct.
and the file exists on the disk.
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1