[MonoDevelop] Visual Studio Web Project

Patrick Barry patrick.barry at thalesgroup.com
Thu Aug 30 03:30:59 EDT 2007

On 8/29/07, Patrick Barry <drpatrickbarry at gmail.com> wrote:
> I am attempting to import a large visual studio 2005 website and I
> would like to clarify a couple of issues.
> Project File
> A visual studio 2005 website does not have a project file so I have
> created an empty class project in Monodevelop and added all of the
> files from the website to it, is this the correct thing to do?

Yes, VS2005 import doesn't work fro web apps yet. A Web Application
project would have been better, but this support needs to be compiled
into MD.

> Partial Classes
> I am missing all of the aspx/ascx/master page control declarations
> that are created in the temporary files that are created by Visual
> Studio.  I can manually create all of the declarations it would be a
> bit of a pain though. Also it would cause problems if I tried to
> compile the project with Visual Studio as it would then find duplicate
> declarations.

Well, if you're developing it "Web Site" style you only need the
declarations for code completion. MonoDevelop can't do this yet.
However, the app will run; they're generated by the ASP.NET compiler
on the web server (including xsp2).

If you do it "Web Application" style so that all the CodeBehind is
compiled before deployment, then either you or the IDE would need to
add these control declaration. MonoDevelop *can* automatically do this
either with or without partial classes if you use a Web Project,
although you'd need to create the partial classes yourself at the
moment; it would just add the members.

You're correct in thinking that you would get duplicate declaration
conflicts with VS2005' Web Site model, but you could just not add
these partial classes to the VS project... or use the Web Application
addin for VS.

> But I suppose I could get around this by declaring a
> CodeFileBaseClass along the lines of:
> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs"
> Inherits="test" CodeFileBaseClass="MyBase"%>

I'm not quite sure what you mean by this.

In my current contract I have developing a number of screens to display
train timetables. Each one has a table created in a repeater and they all
have navigation anchors with runat=server to move forward/backward 1hr, etc
in the time table. I put common functionality for the anchors onServerclick
events in a base page. But this would not work because the anchors would
only exist in the partial classes for each page.

So I done this:

<%@ Reference Page="GridBase.aspx" %>
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
CodeFileBaseClass="MyNameSpace.GridBase_aspx" AutoEventWireup="true"
CodeFile="summary.aspx.cs" Inherits="MyNameSpace.summary_aspx" %>

And then in the base page I have:
        protected HtmlAnchor sixtyd;
        protected HtmlAnchor tend;
        protected HtmlAnchor oned;
        protected HtmlAnchor oneu;
        protected HtmlAnchor tenu;
        protected HtmlAnchor sixtyu;
        protected HtmlAnchor sixtydB;
        protected HtmlAnchor tendB;
        protected HtmlAnchor onedB;
        protected HtmlAnchor oneuB;
        protected HtmlAnchor tenuB;
        protected HtmlAnchor sixtyuB;

I have this declaration on each page. When Visual Studio complies this page
it first checks in the GridBase.aspx.cs file to check if any declarations
have have been made for the runat=server components. If they are there then
the will not be created in the partial class.
It would then be possible to inherit every page from a base page (I wonder
if the CodeFileBaseClass could be itself!) and declare everything so the
tempory partial class file would have no decerations in it.

The soulution could then then be developed in both VS and MD, usefull on my
dual boot machine. I was doing this for a few months 2 years ago on a .Net 1
solution with MD 0.7.


More information about the Monodevelop-list mailing list