Setting processor affinity on CSC.exe launched by CoreCompile MSBuild Task
- by Hardy
I am wondering if there is simple way to ensure that when a c# project is compiled the CSC.exe launched inherits the parent processor affinity settings, or perhaps of a way where by i can supply this.
I have been trying to accomplish this by launching a bat file from vs.net cmd prompt like
start /affinity 01 custombuild.cmd
and inside my custombuild.cmd i have
@echo off
msbuild Libraries.sln /t:rebuild /p:Configuration=Release;platform=x64 /m:1
:END
The command line call to Csc.exe this generates looks like the following
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe ... ignoring the rest for brevity.
What i 'd like to see is the CSC.exe to inherit the processor affinity or a simple way to be able to override how csc.exe call is generated so i can make it into a
start /affinity 01 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe ... ignoring the rest for brevity.
I also noticed that CoreCompile target is defined in Microsoft.CSharp.targets, should i be considering overriding MSBuildToolsPath variable so i can sneak in my own version. This feels rather hacky. Any help would be much appreciated.