A typical post-build event should look like this:

COPY "$(SolutionDir)Resources\abc.xyz" "$(TargetDir)"

Various macros exist for solution dir, output dir etc. But how do I copy to system's special folders? Are there macros for it? I want copy to Common App Data folder.

Why: From the client machine, my app accesses files in common appdata directory. To simulate the scenario in my development machine, I need to ensure abc.xyz is present in my app directory too. How do I copy abc.xyz from $(SolutionDir)Resources\abc.xyz to something like $(App_Data) in post-build?

I can manually copy paste it, every time I update the Resources folder, but I would like to automate it with VS.

Update:

I could do this with xcopy,

XCOPY "$(SolutionDir)Resources\abc.xyz" "%appdata%\MyPath\" 

But that copies to user's local app data path, not common application data. How do I do it for common application data?

有帮助吗?

解决方案

I think you want %ALLUSERSPROFILE%\MyPath. Found using set on the commandline btw.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top