locked
Adding a web site to source control RRS feed

  • Question

  • User206383436 posted

    I am creting a web site in Visual Studio 2013 Professional (New Web Site, not New Project) and I would like get source control on it, so I right-clicked the solution and selected "Add Solution to Source Control", chose "Git" and hit the OK button. After this steps, the following message appears on screen:

    "The current solution has projects that are located outside the solution foder. 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 single folder."

    I created my web site within a folder called "c:\Visual Studio 2013 Projects" where I have all of my VS2013 projects.

    I found an entry about this same issue here but I guess it does not apply to my situation so I will very much appreciate your feedback.

    Respectfully,
    Jorge Maldonado

    Monday, May 5, 2014 11:58 AM

Answers

  • User-1454326058 posted

    Hi JORGEMAL,

    By default, for the web site project, the files or folder of that web site are not in the solution folder unless we change the location manually when we create a new web site project.

    Please refer to these steps below to create a new web site project.

    1. Create a new folder. (E.g. Project, location is C:\Project)
    2. Open VS, File=>New=>Project
    3. Select Installed=>Templates=>Other Project Types=>Visual Studio Solutions
    4. Type the solution name (E.g. SolutionA) and change the location to use C:\Project
    5. Right click the solution=>Add=>New Web Site
    6. Change the location to File System and change the location to C:\Project\SolutionA

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 6, 2014 1:54 AM
  • User-1454326058 posted

    Hi JORGEMAL,

    I see that when a website is created, a solution is also created and placed in a folder different than the folder where the website was created. In this case, the solution file will not take part of the source control

    Since the website files should be in the solution folder (You could check the error message), we should let the website files in the solution folder. That is why I suggest you to create an empty solution first, then create a website under that solution folder.

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 9, 2014 3:37 AM

All replies

  • User-1454326058 posted

    Hi JORGEMAL,

    By default, for the web site project, the files or folder of that web site are not in the solution folder unless we change the location manually when we create a new web site project.

    Please refer to these steps below to create a new web site project.

    1. Create a new folder. (E.g. Project, location is C:\Project)
    2. Open VS, File=>New=>Project
    3. Select Installed=>Templates=>Other Project Types=>Visual Studio Solutions
    4. Type the solution name (E.g. SolutionA) and change the location to use C:\Project
    5. Right click the solution=>Add=>New Web Site
    6. Change the location to File System and change the location to C:\Project\SolutionA

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 6, 2014 1:54 AM
  • User206383436 posted

    Starain chen - MSFT

    6. Change the location to File System and change the location to C:\Project\SolutionA

    Thanks fr your reply.
    After step (6) I get the following message:

    ------------------------------------------------------------------------------------------------------------------------------
    There is already a Web Site containing files at location 'c:\Visual Studio 2013 Projects\TestProject'.

    How do you wish to proceed?

    * Select a new folder to create your Web site.
    * Open the existing Web site.
    * Create a new Web Site in the existing location.
    ------------------------------------------------------------------------------------------------------------------------------

    What would be the correct choice here? I selected "Create a new web site in the existing location" and everything worked without error or warning messages and it seems to me the right choice. However, I would like to make sure I am doing things correctly.

    Regards,
    Jorge Maldonado

    Tuesday, May 6, 2014 10:03 AM
  • User-1404016747 posted

    Visual Studio needs a project file in order to set up source control integration. Web site projects do not have a .vbproj or .csproj file hense the reason you are having issues.
    I would suggest if you really want the integrated Git support found in Visual Studio that you convert the web site to an application.

    Another option would be to not use the Visual Studio Git integration and install either the command line Git application or a GUI application such as TortoiseGit and use it to work with source control outside of Visual Studio. This works just as well if not better than using Visual Studio's built in very basic and stripped down Git support.

    At the moment Git and/or TortoiseGit is far superior to Visual Studio's Git support.
    Visual studio does not support stashing, keeping an eye on branches is a pain, no anotations, no tags, cannot cherry pick commits, and the list goes on...

    Tuesday, May 6, 2014 11:39 AM
  • User-1454326058 posted

    Hi JORGEMAL,

    Create a new web site in the existing location is right.

    Does the solution name is TestProject?

    Based on that message, it means that there is a web site in the TestProject folder. Do you follow up the steps to create an empty solution?

    It will generate a new folder after create a new empty solution.

    Note: For the step 6, you also should add the website name to the location path. (E.g. C:\Project\SolutionA\MyWebSiteAPP)

    Thanks

    Best Regards

    Tuesday, May 6, 2014 9:48 PM
  • User206383436 posted

    I like the idea of using source control directly with Git or, as you suggest, TortoiseGit. I have investigated a little bit about the latter and it is a great tool which, combined with Git Bash, offers an excellent choice. In this case, I suppose that all I need to do is to create my website and then create a new repository in my website's folder. From this point, I just need to follow the commons steps for staging and commiting. Also, I see that when a website is created, a solution is also created and placed in a folder different than the folder where the website was created. In this case, the solution file will not take part of the source control, but I think this is not important because I am not working with a project but with a website.

    I will very much appreciate your feedback.

    Respectfully,
    Jorge Maldonado

    Thursday, May 8, 2014 1:44 PM
  • User-1454326058 posted

    Hi JORGEMAL,

    I see that when a website is created, a solution is also created and placed in a folder different than the folder where the website was created. In this case, the solution file will not take part of the source control

    Since the website files should be in the solution folder (You could check the error message), we should let the website files in the solution folder. That is why I suggest you to create an empty solution first, then create a website under that solution folder.

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 9, 2014 3:37 AM