1. How to select different app.config for several build configurations
You can try the following approach:
- Right-click on the project in Solution Explorer and select Unload Project.
- The project will be unloaded. Right-click on the project again and select Edit <YourProjectName>.csproj.
- Now you can edit the project file inside Visual Studio.
- Locate the place in *.csproj file where your application configuration file is included. It will look like:
<ItemGroup> <None Include="App.config"/> </ItemGroup>
- Replace this lines with following:
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <None Include="App.Debug.config"/> </ItemGroup> <ItemGroup Condition=" '$(Configuration)' == 'Release' "> <None Include="App.Release.config"/> </ItemGroup>
I have not tried this approach to app.config
files, but it worked fine with other items of Visual Studio projects. You can customize the build process in almost any way you like. Anyway, let me know the result.
2. Calling methods from different Projects in one Solution
You need to add a reference to the 3rd project in your 1st project. To do this, right-click on your project, select "Add Reference," then select the project in your solution. Once your main project references the 3rd project, then you can access its public types.