0

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).

Xorcist
  • 3,129
  • 3
  • 21
  • 47
  • you need to copy to same `$(ProjectDir)` folder ? or deploy folder? – NajiMakhoul Dec 10 '20 at 22:18
  • Optimally I would like the files being deployed to be updated before they are actually deployed. I'm specifically talking about the temporary files in the OBJ folder, before they get copied out. But I would settle for changes to the deployed files if I can't change the ones in OBJ. – Xorcist Dec 14 '20 at 12:01

0 Answers0