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

199 views Asked by At

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"
)
1

There are 1 answers

0
MicMan On

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.