empty website and git

前端 未结 3 1813
-上瘾入骨i
-上瘾入骨i 2020-12-21 08:15

hi as am a newbie to GIT with visual studio , I\'m working with an n-tier website with multiple projects and at first i make it as an empty website , so the visual studio

相关标签:
3条回答
  • 2020-12-21 08:32

    Rather than try to move the website files to the solution folder, it appears to be much easier to save a copy of the sln file to the websites folder from within Visual Studio. Then delete the original sln file in the projects folder. Do not just move the sln files in file explorer. The sln file contains paths, and by saving as a new sln the paths are updated.

    The previous answer by @stephen seems like a great idea, but winds up creating duplicate folders in the Projects folder. Subsequently the sln file and the project files still wind up in different directories. @TimSmith-Aardwolf details correcting this, but it is a process.

    The easiest way to proceed I've found is to go to File > Save sln As... and select the website files folder.

    This places a new identically named sln file inside the same folder as the website files. You do not have to close Visual Studio, Solution Explorer now lists the newly saved sln. Right click the Solution and select Add to Source Control. I found this process here and it works great.

    0 讨论(0)
  • 2020-12-21 08:34

    You can delete the website from the solution in visual studio, and then 'add existing project' to solution. Otherwise create a new empty website and enter the solution directory as the location for the website instead of the default location.

    0 讨论(0)
  • 2020-12-21 08:44

    I had the same problem with Visual Studio 2015 and the website templates for .NET Framework 4 (Looks like this has been sorted for templates targeting 4.5).

    This is how I got the files from the template into the project

    1. Click File -> New -> Web site
    2. Select Templates -> Visual C# -> ASP.NET Web Forms Site
    3. Leave Web location as File System and choose a folder. I used C:\Users\tim\Documents\Visual Studio 2015\Projects\WebSite4
    4. Click OK

    You'll now see in Windows Explorer there are two folders WebSite4 and WebSite4 (2). The second folder has the sln file and packages folder.

    1. Create a folder in WebSite4 (2) called Website
    2. Copy the contents of Website4 into WebSite4 (2)\Website

    Return to Visual Studio

    1. In Solution Explorer, right click WebSite4 and then click Remove. Click OK to confirm.
    2. Right click Solution, click Add -> Existing Website.
    3. Select the folder WebSite4 (2)\Website and click Open.

    Bonus - rename the solution 10. Right click Solution 'WebSite4 (2)' and click Rename. Remove the (2)

    Bonus - rename the folder

    1. Rename the folder
    2. Close the solution
    3. Rename the folder in Windows Explorer
    4. Open -> Project/Solution

    Once that was all done I was able to publish the project to a remote git repository through Team Explorer.

    0 讨论(0)
提交回复
热议问题