Setting processor affinity on CSC.exe launched by CoreCompile MSBuild Task

Posted by Hardy on Stack Overflow See other posts from Stack Overflow or by Hardy
Published on 2012-07-09T03:04:57Z Indexed on 2012/07/09 3:15 UTC
Read the original article Hit count: 284

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about msbuild

Related posts about msbuild-task