Monday, May 19, 2014

Add ASP .NET Empty Web Site to Git Source control

Visual Studio 2013 have feature to add your .NET projects to Git source control. But when you try to add your ASP NET Empty Web Site solution to Git Source control it failed. The message is:
The current solution has projects that are located outside the solution folder. These projects will not be source controlled in the Git repository. To add all the projects to a single Git repository please consolidate all projects under a singe folder.

Here are step by step instruction how to create new ASP NET Empty Web Site which can be added to GIT source control.

  • First open New Web Site in Visual Studio



  • the second step is to choose ASP .NET Empty Web Site,I choose NewWebSite for name of a site, after button OK is clicked site will be created in
    C:\Users\Name\Documents\Visual Studio 2013\WebSites\NewWebSite
    folder.
    Inside path instead of Name will be User name on your computer



  • Solution is created. If you click on Solution NewWebSite and look in the properties prpoerty Path you will see solution file is located inside:
    C:\Users\Name\Documents\Visual Studio 2013\Projects\NewWebSite\
    It is not good if you want to add your web site to source control

  • Click on the solution file, click menu FILE --> Save NewWebSite.sln As ...
    Now save your solution file inside WebSite folder:
    C:\Users\Name\Documents\Visual Studio 2013\WebSites\NewWebSite
    Your .sln file should be in same folder as WebSite project

  • maybee it is good idea to delete folder:
    C:\Users\Name\Documents\Visual Studio 2013\Projects\NewWebSite\
    to make things simpler

  • Now you can click FILE --> Add to Source Control


  • Choose Git radio button and click OK.

  • So, you successfully created Local Git Repository for your ASP .NET Empty WebSite

No comments: