Reputation: 82361
I have a post build event like this:
if NOT "$(OutDir)" == "Binaries\" "$(SolutionDir)Tools\NuGet.exe" pack "$(ProjectDir)MyAssembly.nuspec" -BasePath "$(ProjectDir)$(OutDir)."
But what I really want to do is check to see if $(OutDir) Contains the word Binaries.
Is there a way to do this? I tried:
if NOT "$(OutDir)".Contains("Binaries") "$(SolutionDir)Tools\NuGet.exe" pack "$(ProjectDir)MyAssembly.nuspec" -BasePath "$(ProjectDir)$(OutDir)."
But it does not work.
So, as a bonus point, what language is the "Post-Build" event supposed to be?
Upvotes: 0
Views: 2397
Reputation: 82361
Turns out it is MS-Dos. So most batch file kind of stuff is allowed.
Here is the command I ended up using:
@Echo off&Setlocal EnableDelayedExpansion
set BinariesVar=Binaries
set "PathDir=$(OutDir)"
IF "!PathDir:%BinariesVar%=!" NEQ "%PathDir%" (if $(ConfigurationName) == Release "$(SolutionDir)Tools\NuGet.exe" pack "$(ProjectDir)MyAssembly.nuspec" -BasePath "$(OutDir).") else (if $(ConfigurationName) == Release "$(SolutionDir)Tools\NuGet.exe" pack "$(ProjectDir)MyAssembly.nuspec" -BasePath "$(ProjectDir)$(OutDir).")
This will use the first path is the build is not via TFS and the second path for TFS Builds.
Upvotes: 1