Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

c# - Copying files into the application folder at compile time

If I have some files I want to copy from my project into the .indebug folder on compilation, then it seems I have to put them into the root of the project. Putting them into a subfolder seems to copy them into the .indebug folder in the same structure they're stored in.

Is there any way to avoid this?

Just to be clear: if I have a MyFirstConfigFile.txt and MySecondConfigFile.txt in a ConfigFiles folder and I set their Copy to Output to be Copy..., then they appear in the .indebugConfigFiles folder. I want them to appear in the .indebug folder.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could do this with a post build event. Set the files to no action on compile, then in the macro copy the files to the directory you want.

Here's a post build Macro that I think will work by copying all files in a directory called Configuration to the root build folder:

copy $(ProjectDir)Configuration* $(ProjectDir)$(OutDir)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...