Project A (a web app) depends on Project B (an exe) - I need to copy the exe using Project A's post-build event from bin
of Project A to wwwroot of Project A.
I want to copy a binary from wherever it's dropped (bin/debug or bin/release or bin/debug/netcoreapp2.0 etc) without knowing the build configuration or target framework. Right now I'm doing this:
copy /Y $(ProjectDir)bin\debug\netcoreapp2.0\app.exe $(ProjectDir)wwwroot\exe\app.exe
Which works great locally, but when it builds somewhere else with a Release
configuration, it fails. I could use some if/then checks but I'd rather have a macro that replaces the $(ProjectDir)bin\\debug\\netcoreapp2.0
chunk of the path so I'm always grabbing what I need without any knowledge of configuration/framework.
I've tried to use $(OutDir)
and $(TargetDir)
with no luck - these just give me the non- bin
path.
Which macro should I be using?
$(TargetPath)
should be the complete path to your output executable. Not sure what you mean about $(TargetDir)
giving you the 'non-bin' path. Not really a C# question BTW.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.