Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5956659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:17:21+00:00 2026-05-22T18:17:21+00:00

I have several ASP.NET MVC web projects that all need access to the same

  • 0

I have several ASP.NET MVC web projects that all need access to the same set of configuration files. Since I have multiple configuration files that need to be shared, it is not ideal to have multiple copies of them.

With Maven3, I can overlay individual J2EE webapp’s on top of others upon build so I could make one project that contains only config files and have it combined into each of the individual web application projects.

Is there any way to achieve this with MSBuild or any other .NET build tool?

My only solution is to use a build event to copy the files from one project into the others, but when creating a deployment package via MSBuild, it only packages files that are a part of the project, and ignores any additional files that are in the folder.

My ultimate goal is to include these config files in the deployment projects that are generated with msbuild /t:Package (which are eventually deployed to IIS7 with, hopefully, everything they need).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:17:21+00:00Added an answer on May 22, 2026 at 6:17 pm

    I found a solution to my problem.

    • I place my configuration files in a folder in some shared project.
    • Right click on the configuration files and select Properties.
    • Ensure Build Action is Content and Copy to Output Directory is Copy Always
    • Reference “Shared Project” from “Main Project 1” and “Main Project 2”

    Now, when “Main Project 1” and “Main Project 2” are built, their reference project (“Shared Project”) will also be built and it will have the configuration files published to the /bin directory.

    To access these configuration files:

    string configPath = HttpRuntime.BinDirectory + string.Format(@"ConfigDirectory\{0}.config", someConfigFileName );
    

    Then you can read this config file (assuming it is in the standard .NET config format) using:

    ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap
                {
                    ExeConfigFilename = configPath
                };
    Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
    
    var settings = ((AppSettingsSection)config.GetSection("appSettings")).Settings;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several ASP.NET MVC 3 Web applications that have a lot of common
i have a asp.net mvc application which uploads several xml files that are used
I have a Solution with several projects in it, including two asp.net mvc projects
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on
I have this web app that is running ASP .NET MVC 1.0 with LINQ
We manage several ASP.NET MVC client web sites, which all use a data annotation
I have an ASP.NET MVC web application that makes REST style web service calls
I have several Silverlight, WP7 and ASP.NET MVC client applications Most allow anonymous access
I have several forms in ASP.Net MVC. I noticed that some of the dropdowns
ASP.Net MVC Controllers have several methods of forwarding control to another controller or action.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.