.vs\config\applicationhost.config in source control

49,494

Solution 1

You should ignore .vs folder all together.

However, there are cases where you want to persist some config on your applicationhost.config file such as registering FQDN as explained here.

For this type of config, you want to use the global application host file where you can persist your changes.

In a classic Web Application project (where you have .csproj file), you need to set the UseGlobalApplicationHostFile property to true inside the .csproj file:

<UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile>

VS 2015 honors this and uses the global application host file. However, there is no way to tell ASP.NET 5 projects to look for this today as far as I know.

Solution 2

If you need custom configuration for IIS Express (example), add the file to source control so that it is shared with the team. If not, you can exclude this file, and VS2015 will recreate it as needed.

Share:
49,494
Thad
Author by

Thad

Microsoft MVP (Development Technologies) Senior Developer for SixPivot @DavidRGardiner

Updated on October 07, 2020

Comments

  • Thad
    Thad over 3 years

    Visual Studio 2015 adds a file named .vs\config\applicationhost.config to the root of a solution when an ASP.NET Web application project is created.

    Should this file be checked in to source control or should it be ignored (so that each user will have their own local copy)?

  • antao
    antao over 8 years
    Should this key be ignored in the .csproj as well? I am having couple of issues regarding usage of VS2015 while some colleagues use VS2013 version. VS2015 adds it with an empty value. Thanks
  • Admin
    Admin about 8 years
    I've seen that advice in a number of different places. But they never say bloody where in the csproj to put that line :|
  • tugberk
    tugberk about 8 years
    that's a property. Put it under any property group.
  • Gustin
    Gustin almost 8 years
    I.e. for ASP.NET 5 projects, the best option we have is to check in that applicationhost.config file into Source Control - correct?
  • Simon
    Simon over 7 years
    I get in touble when using the global ApplicationHost.config file: For my Project, I have two different svn branches checked out to my local machine. When I change my work in Visual Studio 2015 between these branches, I have to change the physical path in the ApplicationHost.config every time to checked out folder. Any Idea to solve this problem?
  • CularBytes
    CularBytes over 7 years
    removing the file/folder from source control, checking that in, re-open visual studio worked for me.
  • user2972061
    user2972061 about 7 years
    This <UseGlobalApplicationHostFile>True</UseGlobalApplicationHost‌​File> was auto set true before VS 2015. well thanks I forget to set it true.
  • Steven Liekens
    Steven Liekens over 2 years
    Do you happen to know where is the template for this file? First I thought it would just make a copy of the global ApplicationHost.config file and put it in .vs but that seems to be not the case.