C# / Visual Studio

C# / Visual Studio


Share a file between multiple projects?

Fx. share app.config to Test project:

Step 1: Place the App.Config file in a folder parent to both(or all) the projects that needs to use the same Config file. I have put it in a new folder called AppConfig. [Actually it don’t have to be parent to both]
Step 2: Right click on each project and select the same App.config file but add it as Link. [That’s the important part]



It is a little different if we talk about web.config:

Here I found that you can put a pre-build event to the target project. Fx. a UnitTest project where you depend on web.config:

copy “$(SolutionDir)\SourceProject_RENAME\[web.config]” “$(ProjectDir)$(OutDir)$(TargetFileName).config






Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s