asp.netiis-7.5projects-and-solutionssln-file

Is it a bad idea for my solution and project to be stored in separate locations?


Somehow my solution and project differ as to their Path/FullPath.

The Path property of my solution ("customerreportingnet") is:

C:\Users\cshannon\Documents\Visual Studio 2013\Projects\customerreportingnet\customerreportingnet.sln

The only project beneath that solution is a Website ("http://localhost/EMS/customerreportingnet/").

The website project's FullPath is this:

C:\EnhancedMonthlySalesReporting\customerreportingnet\customerreportingnet

Why would the solution and project location differ?

Did I do something wrong in the setup? I downloaded the files from a .zip file, and extracted them to C:\EnhancedMonthlySalesReporting\

I then created a Virtual Directory in IIS, mapped it to C:\EnhancedMonthlySalesReporting\customerreportingnet\customerreportingnet, giving it the Alias "EMS".

Then in VS I open the website (solution/project) this way:

File > Open Website...

and then I open IIS > EMS

When I do this, I do not see any files beneath the "project" - all that's visible in the Solution Explorer are just the solution and project names - no subfolders or files beneath them. But when I right-click the solution "customerreportingnet" and select "Open Web Site", then reply OK to "Open the Web site (this will close the current solution)" all is relatively well - I can right-click the project ("http://localhost/EMS/customerreportingnet/"), select View in Browser (Internet Explorer) and the site runs.

The only files in C:\Users\cshannon\Documents\Visual Studio 2013\Projects\customerreportingnet\ are:

customerreportingnet.sln customerreportingnet.v12.suo

C:\EnhancedMonthlySalesReporting\customerreportingnet\customerreportingnet has those files and many more (as well as beaucoup folders).

Should I try to reset the solution Path to C:\EnhancedMonthlySalesReporting\customerreportingnet\customerreportingnet, or is that just an oddity, but not a problem?

If so, is that as easy as just changing that property value, or will that mess things up?


Solution

  • After you extracted your code and opened the project in visual studio.

    Visual studio will automatically create a solution file if you open a project (you can also open a solution file directly). Once you click save all or save your solution file it will save it to the previous location or to the default location.

    Since you did not save the file before, visual studio will save it to the default location:

     C:\Users\cshannon\Documents\Visual Studio 2013\Projects\[ProjName]\[ProjName].sln
    

    If you want other developers to be easily able to open your project. (especially when you start to have multiple projects inside 1 solution), you want to include the solution file inside the project location. Otherwise every developer has to create this solution file himself, which is annoying and cumbersome work.

    Since dotnet core the best practice file structure is this:

    /root
       /src <== contians all the projects per folder
          /project1
             /project1.csproj
             /etc*
          /project2
       /[ANameForSolution].sln (so directly inside the proj folder, next to src)
    

    The old habit people use was more flat:

    /root
       /project1
       /project2
       /YourSolution.sln
    

    The best practice, moving everything to /src is because lately a root of the project already has a lot of (config) files, and this way you can keep the root a bit cleaner.