Visual Studio: Run C++ project Post-Build Event even if project is up-to-date
You can use the Custom Build Step property page to set up a batch file to run. This runs if the File specified in the Outputs setting is not found, or is out-of-date. Simply specify some non-existent file there, and the custom build step will always run. It will run even if your project is up-to-date, since the Output file is never found.
Visual Studio add pre-build event that always runs (C# project)
Here's the solution. Define this property in your project file:
<PropertyGroup>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
PreBuildStep will then execute every time, regardless of whether the project is or isn't up to date.
It seems that Visual Studio is bypassing normal up-to-date checks of MSBuild and using some sort of custom check that is faster, but has a side effect of breaking customized build targets.
Post-Build Event Works With one Project But Not the Other
You should normalize all your arguments, so they don't contain outer quotes.
Then you can use them in a reliable way.
The syntax set "variable=%~1"
avoids outer quotes in the variable itself.
set "TargetDir=%~1"
set "VersionNumber=%~2"
set "TargetFileName=%~3"
set "TargetName=%~4"
SET "productionpath=Z:\IT Support App\"
set "dateStamp=%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%"
MOVE "Z:\IT App\%TargetFileName%" "Z:\IT App\_archive\%TargetName%.%dateStamp%-%VersionNumber%"
XCOPY "%TargetFileName%" "Z:\IT App"
How to run Visual Studio post-build events for debug build only
Pre- and Post-Build Events run as a batch script. You can do a conditional statement on $(ConfigurationName)
.
For instance
if $(ConfigurationName) == Debug xcopy something somewhere
Related Topics
Why Is Cuda Pinned Memory So Fast
Clean C++ Granular Friend Equivalent? (Answer: Attorney-Client Idiom)
Why Using the Const Keyword Before and After Method or Function Name
Difference Between Std::Result_Of and Decltype
Which Stl Container Should I Use for a Fifo
How to Solve Memory Fragmentation
Std::Thread Calling Method of Class
Differencebetween a Template Class and a Class Template
Generating a Normal Map from a Height Map
Differencebetween a Static and Const Variable
How to Get a "Codesigned" Gdb on Osx
How to Target Windows Xp in Microsoft Visual Studio C++
Why Is There No Support for Concatenating Std::String and Std::String_View
Why Was the Space Character Not Chosen for C++14 Digit Separators
Why Are C++ Stl iOStreams Not "Exception Friendly"