136

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)?

Mathieu Renda
  • 9,413
  • 1
  • 23
  • 29
David Gardiner
  • 16,233
  • 16
  • 71
  • 115

2 Answers2

116

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.

Henke
  • 1,466
  • 2
  • 9
  • 22
tugberk
  • 54,046
  • 58
  • 232
  • 321
  • 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 – antao Sep 08 '15 at 15:24
  • 3
    I've seen that advice in a number of different places. But they never say bloody *where* in the csproj to put that line :| –  Apr 20 '16 at 18:44
  • 3
    that's a property. Put it under any property group. – tugberk Apr 21 '16 at 14:51
  • I.e. for ASP.NET 5 projects, the best option we have is to check in that applicationhost.config file into Source Control - correct? – Gustin May 23 '16 at 12:01
  • 1
    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? – Simon Oct 04 '16 at 09:59
  • removing the file/folder from source control, checking that in, re-open visual studio worked for me. – CularBytes Oct 10 '16 at 21:53
  • This True was auto set true before VS 2015. well thanks I forget to set it true. – user2972061 Feb 17 '17 at 08:40
9

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.

Community
  • 1
  • 1
Edward Brey
  • 35,877
  • 14
  • 173
  • 224