Solution file not in the solution folder

G

Guest

Why is it that when I create a new web application, the project folder
containing the webform, web.config and csproj files appears in
C:\inetpub\wwwroot, yet my .sln and .suo files appear in another folder in My
Documents\Visual Studio Projects?

Is this normal, or have I somehow made an inadvertant change somewhere?
 
D

Damien

cashdeskmac said:
Why is it that when I create a new web application, the project folder
containing the webform, web.config and csproj files appears in
C:\inetpub\wwwroot, yet my .sln and .suo files appear in another folder in My
Documents\Visual Studio Projects?

Is this normal, or have I somehow made an inadvertant change somewhere?

This is normal behaviour. Solution files are solution files. With all
the extensibility in VS, solution files are designed to not know
anything about the projects they might contain. So when VS comes to
create a solution file, it creates it in the same place it creates any
other solution files (by default).

Now, some of the new project wizards let you dictate separate locations
for the solutions directory and the project directory, but the new
website wizard isn't one of them (at least under 2003, not sure about
2005).

Now, you might think that you could create a folder under
c:\inetpub\wwwroot, create a blank solution under there, and then put
the project in the same folder. But VS will complain that the folder
exists...

You could create the project and then move the solution file, and that
should work fine. However, for larger jobs, you might have several
non-web projects and a web project in the same solution (e.g. if you
have a data layer DLL and a Business layer DLL). If that's the case, VS
will be happiest if you have these other projects in sub folders below
where your solution is located. Which if you've put the solution under
the inetpub\wwwroot directory will considerably clutter that area (plus
if you plan to XCopy deploy your project, not only are your code behind
files sitting in a potentially web accessible location*, but so are
your code files for your DLLs.

*only if an administrator misconfigures IIS, to be sure, but why take
the risk.

Damien
 
L

Laurent Bugnion

Hi,
Why is it that when I create a new web application, the project folder
containing the webform, web.config and csproj files appears in
C:\inetpub\wwwroot, yet my .sln and .suo files appear in another folder in My
Documents\Visual Studio Projects?

Is this normal, or have I somehow made an inadvertant change somewhere?

When you create a new solution, you can specify where the solution file
must be saved. You can change the defaults under Tools / Options /
Projects and solutions.

I like to have the following structure:

+ Application/Library folder
+ _current
- Solution File
+ Project 1 folder
- Project file
(+ Project 2 folder)
(...)

This allows me to make backups easier. However, in ASP.NET 1.1, you must
manually create a virtual folder in IIS pointing to the corresponding
project folder.

You can also move the solution files around, and then open it again. In
ASP.NET 2.0, if you save the web project to the file system, it will
tell you that it doesn't find it anymore, but it's easy to use the
properties (F4) to set the correct location again.

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top