简体   繁体   中英

How can I add an existing file to a project in Visual Studio in the pre-build event?

I have a batch file creating a config file that I don't want to share with all team mates over SVN because it's used for developer specific settings. The config file is called from app.config and is necessary in order to build the project and I don't want anyone to have an issue if they build the solution or just the project itself.

Is there a way I can add my newly created config file to the project automatically through the pre-build event?

Here's the code I'mn running in my pre-build event:

if not EXIST "$(ProjectDir)\Config\Dev.config" (
  cd $(ProjectDir)
  call "$(ProjectDir)\Config\Create_DevConfig.bat"
)

It turns out I had already fixed it when I had included it in the project but I had removed it from SVN. Then it wasn't just some "random" file flying around outside the project by itself, even when it was re-created.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM