We have a couple of DLLs that开发者_如何学编程 need to be put in the GAC at compile time only in Debug mode as this is what developers use locally. Release mode will be the Continuous Integration server build and we will not want to put any dlls in the GAC.
We used to do something similar with post build events on a project, but if a post build event can be conditionally run if debug.
What is the best way to achieve this?
If you want your post build event to run only in debug mode, configure it this way:
if not $(ConfigurationName) == Debug goto end
...your commands here...
:end
Or, more generically, to run different commands on each configuration:
goto $(ConfigurationName)
:Debug
...commands for debug mode
goto end
:Release
...commands for release mode
goto end
:end
if $(ConfigurationName) == Debug "C:\Program files\Microsoft Visual Studio 8\SDK\v2.0\Bin\GacUtil.exe" -i "$(TargetPath)"
if $(ConfigurationName) == Debug "C:\Program files\Microsoft Visual Studio 8\SDK\v2.0\Bin\GacUtil.exe" -i "$(TargetDir)\Perito.Framework.Common.CallbackTransport.Interfaces.dll"
精彩评论