VS 2010 build on 32bit and 64 bit (Program Files)
I have a VS 2010 Post Build Event that runs GacUtil.exe
.
On my 32-bit laptop I reference:
"C:\Program Files \Microsoft SDKs\Windows\v7.0A\bin\gacutil.exe" -i "$(TargetPath)".
On my 64-bit dev server it needs to be
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\gacutil.exe" -i "$(TargetPath)".
But I want to check-in a pr开发者_StackOverflow中文版oject that works on both systems.
Has anyone figured out how to do a post build event that is architecture independent?
I call this in the post-build step: sgen.
Update Visual Studio 2013:
This command works both on 32- and 64-bit machines:
"$(SDK40ToolsPath)$(SGenSubFolder)sgen.exe" /nologo /force /assembly:"$(TargetPath)" /compiler:/platform:$(Platform) /type:"[NameOfTheType]"
The $(SGenSubfolder)
property is defined as
<PropertyGroup Condition=" '$(Platform)' == 'x64' ">
<SGenSubFolder>x64\</SGenSubFolder>
</PropertyGroup>
What a mess...
for /f "tokens=2,*" %a in ('reg query "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.0a" /v InstallationFolder ^| findstr InstallationFolder') do "%b\bin\Gacutil.exe" -i "$(TargetPath)"
精彩评论