I install on my Windows 10 machine (is a x64 machine) an old VS2013 Professional/VS2015 Professional. I have a Visual C++ solution/project for native x86 Platform and I'm trying to compile it with MSBuild.
First of all: which MSBuild should I select?
I tried to select the one from registry key: HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
But perhaps this is not the right tools (there's an indication in this site about this), because it points to: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
Which is the Msbuild tool for C#/Vb.net projects and not for native x86 platform. Perhaps there a recent change in a windows update about this, that change the registry value. Then I tried to change it to: VS 2013: C:\Program Files (x86)\MSBuild\12.0\Bin\
VS 2015: C:\Program Files (x86)\MSBuild\14.0\Bin\
Then I set the environment to:
VS 2013: VCTargetPath = c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
VS 2015: VCTargetPath = c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
I open a "native x86 command prompt" (with "Run as Administrator") from VS2013/2015 and then I run the following:
VS2013:
set VCTargetPath = \MSBuild.exe project.vcxproj /nologo /p:PlatformToolset=v120;Configuration=Debug /v:detailed
VS2015:
set VCTargetPath = \MSBuild.exe project.vcxproj /nologo /p:PlatformToolset=v140;Configuration=Debug /v:detailed
I obtain always the error: LNK 1158 - cannot run \cvtres.exe
Project file project.vcxproj indicates correctly Platform=Win32 and PlatformToolset (one of the above specific for VS 2013/2015). Path of the cvtres.exe file seems correct: using sysInternals ProcessMonitor utility i see that the file cvtres.exe is correctly found. But, when executing with msbuild, it first load the cvtres.exe copy that is in directory: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
and then it try to load and execute the one in:
VS 2013: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/BIN/cvtres.exe
VS 2015: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/BIN/cvtres.exe
Even executing the link command, out of MSBuild chain, that loads only the specific cvtres.exe file (not the copy), is correcly executed.
There's probably something of inconsistent in the msbuild tool chain or some IT policy in my PC domain that blocks cvtres.exe execution when it flows through the copy in: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
Do you have any suggestion about it on how to find where is the problem?