How can I limit my post-build events to running only for one type of build? I'm using the events to copy DLLs to a local IIS virtual directory but I don't want this happening on the build server in release mode.
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
- (ASP.NET) Project file must include 'WindowsBa
相关文章
- How to show location of errors, references to memb
- How to track MongoDB requests from a console appli
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- Copy different file to output directory for releas
- Edit & Continue doesn't work
- “Csc.exe” exited with code -1073741819
- Visual Studio: Is there an incremental search for
In VS 2012 you have to use (I think in VS 2010, too)
$(ConfigurationName) was listed as a macro, but wasn't assigned.
Compare: http://msdn.microsoft.com/en-us/library/c02as0cs(v=vs.110).aspx
alternatively (since the events are put into a batch file & then called), use the following. (in the Build event box, not in a batch file):
This way you can have events for any configuration, and still manage it with the macros rather than having to pass them into a batch file & remember that %1 is $(OutputPath) etc:
Add your post build event like normal. Then save you project, open it in Notepad (or your favorite editor) and add condition to the PostBuildEvent property group. Here's an example:
Pre- and Post-Build Events run as a batch script. You can do a conditional statement on
$(ConfigurationName)
.For instance
You can pass the configuration name to the post-build script and check it in there to see if it should run.
Pass the configuration name with $(ConfigurationName)
Checking it is based on how you are implementing the post-build step -- it will be a command-line argument
FYI, you do not need to use goto. the shell IF command can be used with round brackets: