I am working on upgrading our TeamCity projects from VS2012 to VS2015 and I am running into an issue compiling our MVC application.
Old MSBuild (v4.0.30319.34209) g
In our case we use Atlassian Bamboo as build server with build agents running Windows Server 2012 (not R2). So installing the Windows 10 SDK or Visual Studio Build Tools 2017 or 2019 was not an option because it won't install on Windows Server 2012 because it does not meet system requirements.
I got it working with a pre-build event added to the VS project. (Thanks Joseph Haslinger for the idea)
The pre-build event added to the project properties calls a PowerShell script with the following command:
powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(ProjectDir)pre-build.ps1 $(ProjectDir) $(TargetFileName)
The command is based on the one from Jiří Činčura of tabs ↹ over ␣ ␣ ␣ spaces
I’m setting
ExecutionPolicytoBypassin case somebody would not have it set toUnrestricted.