ASP.NET Web Projects retrieved from Repository

ASP.NET Web Projects retrieved from Repository

am 21.04.2008 17:25:10 von Andy

When I open a web project from a sandbox, Visual Studio reports:

=93The project you are trying to open is a Web project. You need to
open it by specifying its URL path=94

The project is checked out from a repository into a sandbox. I don=92t
want the developer to have to setup IIS on their local machine to
enable the editing of the web project =96 I want to configure the web
project so that it only references files in the developer=92s sandbox.
The application=92s system dependencies, anyway, require all the
binaries to be copied to a test server for anyone to be able to run
and check their work.

I heard it is possible to bypass IIS by enabling web sharing on a
sandbox=92s folder. I did this by clicking properties, selecting Web
Sharing, and chosing =93Share this folder=94 and giving the same alias
name as the virtual folder name IIS uses on the test server.

Despite doing this, I still get the Web Project error. What am I
doing wrong?

Here=92s my current configuration of the solution, project, and files in
the sandbox, any help would be much apprecieated:



Sandbox:

G:\MySandBox\MyWebApp.sln
G:\MySandBox\MyWebApp.csproj.webinfo
G:\MySandBox\MyWebApp.csproj
G:\MySandBox\default.aspx
G:\MySandBox\default.aspx.cs
G:\MySandBox\default.aspx.resx
G:\MySandBox\Global.asax
G:\MySandBox\Global.asax.cs
G:\MySandBox\Global.asax.resx



MyWebApp.csproj.webinfo:







MyWebApp.sln:
Microsoft Visual Studio Solution File, Format Version 8.00
Project(=93{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}=94) =3D =93MyWebApp=94,
=93MyWebApp.csproj=94, =93{DB706866-A668-BD49-9501FCC23690}=94
ProjectSection(ProjectDependencies) =3D postProject
EndProjectSection
EndProject


Thanks in advance, Andy

Re: ASP.NET Web Projects retrieved from Repository

am 22.04.2008 17:31:45 von Andy

Well, according to http://msdn2.microsoft.com/en-us/library/ms998208.aspx
you can't force a web project to use local file access in visual
studio .NET.

Visual Studio always uses the HTTP protocol to access and modify files
for web projects, and this means that if you are using a repository
with web projects, you need to have a copy of IIS that's local to your
server running to translate the HTTP requests into local file access
commands for your sandbox.

To enable this, you have to create virtual directories that point to
the folders that hold the web projects in your sandbox. You can do
this in one of two ways: through IIS Manager or by setting the
webshare tab on the properties sheet of the folder. It doesn't matter
which you choose as both approaches create and configure virtual
directories in IIS. I found that setting the webshare tab is easier
and less confusing.

Right click the web project folder in your sandbox and select
properties from the popup menu. On the "Web Sharing" tab of the
properties dialog that opens, click "Share this folder".

On the Edit Alias dialog that appears, select all permissions. The
Alias textbox should be populated with the folder name. Click [OK] to
close the dialog, and then [OK] again to close the property sheet.
You have just created a virtual directory; you do not need to file
share the folder.

Edit the project's webinfo file to specify where the project file is
in relation to the virtual directory you have just created. The
webinfo file will have the same name as the project file, except it
will also have a .webinfo suffix. Locate the URLPath attribute of the
Web XML tag and set the path to:

http://localhost/youraliasname/yourprojectfilename.??proj

where youraliasname is the name you entered in the alias textbox of
the previous step. The server will always be localhost.

Edit the solution file and make all the web project file paths
relative; this means removing the http://server part and leaving just
the project filename.

Now, when you launch Visual Studio.NET and open a solution in your
sandbox that has web projects in it, the projects will load and the
code that is presented for editing to you will in fact be what's in
the sandbox and not from a website in IIS.

When you check the solution back into the repository, don't checkin
the webinfo files. These are specific to each developer.