VS2019 move post build event to post publish event?

214 Views Asked by At

I'm having a hard time finding a way to only rename a file when publishing an application (using Visual Studio 2019). I had no issue doing this with a post-build event, but that actually changes the file in my project, and I just want the file changed in the deployed version.

To make this more complicated, I'm pulling the version number dynamically from a DLL, here is my post-build event:

for /f "delims=" %%A in ('PowerShell.exe -Command ^(Get-Item $(OutDir)MyApp.dll^).VersionInfo.FileVersion') do set "ver=%%A"
copy /Y "$(ProjectDir)\somefile.ext" > "$(ProjectDir)\somefile_%ver%.ext"

What Target or PropertyGroup should I be using to do the same thing, but either from the OBJ temporary package location (before copy) or from the published files location (after copy).

0

There are 0 best solutions below