471,317 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

.NET 2.0 Code Challenge

Roy
Get the following code to compile using .NET 2.0. You can use VS Team Studio,
the command line complier, etc.

The restrictions are:
1. Place no code in the APP_CODE folder.
2. Do not create a second project that is referenced by the first.

The code is extremely simple:

1. Create a new web site
2. Add a new class to the project
3. In the Page_Load handler of default.aspx.cs, create a reference to the
new class.

For example:

in file Default.aspx.cs
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TestClass tc = new TestClass();
}
}

in file TestClass.cs
public class TestClass
{
public TestClass()
{
}
}

That's it! Simple, yet, the code will not compile as is.
Dec 12 '05 #1
11 1363
Currently, the only way to get code to compile is to place it in the
APP_CODE folder. Why are you against doing this? This is the way
things are set up and until MS comes up with another way, then we will
have to stick with this method.

Dec 12 '05 #2
Roy
> Why are you against doing this?

I'm against it because I should be the one to decide on my project
structure...not Microsoft. Frankly, I'm surprised you had to ask.

Roy
Dec 12 '05 #3
Soon you will have the opportunity to use the same project structure in
Visual Studio 2005 as you are used in Visual Studio 2003. But for now code
placed in one of the special directories (that start with APP) will be
protected, the ISAPI filter will make sure that the content in these
directories are NOT accessible through http requests.

Gabriel Lozano-Morán
MCSD .NET
Real Software
http://www.realdn.be
http://www.realsoftware.be
Dec 12 '05 #4
You mean you haven't yet learned the golden rule of Microsoft
development?

"If you do it whichever way Redmond thought you should do it,
development will be a breeze. If you insist on doing it your own way,
development will be hell."

Otherwise known as, "Don't push on a rope," "Don't spit into the wind,"
etc.

I'm not being sarcastic... coming to C# after years of C / Java
programming, that's what I'm finding. :-)

Dec 12 '05 #5
And why would I want to do this?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
Get the following code to compile using .NET 2.0. You can use VS Team
Studio,
the command line complier, etc.

The restrictions are:
1. Place no code in the APP_CODE folder.
2. Do not create a second project that is referenced by the first.

The code is extremely simple:

1. Create a new web site
2. Add a new class to the project
3. In the Page_Load handler of default.aspx.cs, create a reference to the
new class.

For example:

in file Default.aspx.cs
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TestClass tc = new TestClass();
}
}

in file TestClass.cs
public class TestClass
{
public TestClass()
{
}
}

That's it! Simple, yet, the code will not compile as is.

Dec 13 '05 #6
Well you can always create a dll and call your class up that way. At least
that's how MS envisions you doing it.

-Marc

"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
You mean you haven't yet learned the golden rule of Microsoft
development?

"If you do it whichever way Redmond thought you should do it,
development will be a breeze. If you insist on doing it your own way,
development will be hell."

Otherwise known as, "Don't push on a rope," "Don't spit into the wind,"
etc.

I'm not being sarcastic... coming to C# after years of C / Java
programming, that's what I'm finding. :-)

Dec 13 '05 #7
RCS
I'm afraid to ask if the command-line parameters are ok with you too.
Because Microsoft came up with those, and didn't check with you. I mean, you
should be able to type whatever command-line parameters you want, right?

Maybe I'm not getting it?

"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
Why are you against doing this?


I'm against it because I should be the one to decide on my project
structure...not Microsoft. Frankly, I'm surprised you had to ask.

Roy

Dec 13 '05 #8

"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
Get the following code to compile using .NET 2.0. You can use VS Team
Studio,
the command line complier, etc.

The restrictions are:
1. Place no code in the APP_CODE folder.
2. Do not create a second project that is referenced by the first.

The code is extremely simple:

1. Create a new web site
2. Add a new class to the project
3. In the Page_Load handler of default.aspx.cs, create a reference to the
new class.

For example:

in file Default.aspx.cs
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TestClass tc = new TestClass();
}
}

in file TestClass.cs
public class TestClass
{
public TestClass()
{
}
}

That's it! Simple, yet, the code will not compile as is.


You can't do this with the current Web project model, a new project template
will be released soon that suits your needs. Please read this for more
details.

http://weblogs.asp.net/scottgu/archi...07/432630.aspx

Willy.

Dec 13 '05 #9
Roy
Thanks Willy. Your post was most helpful!!

Roy
Dec 13 '05 #10
Roy
> Maybe I'm not getting it?

Correct...you don't get it.

Roy
Dec 13 '05 #11
Why does it matter? Frankly, I'm surprised that you don't like the new
structure given exposure to VS 2003.

Then again, if you don't like the way VS handles your setup, you can always
use Notepad.

(Personally, I am using VWD Express (VS Lite) and I really like it. In the
past, I would use text editors for my development work because I didn't like
the way VS worked.)
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
Why are you against doing this?


I'm against it because I should be the one to decide on my project
structure...not Microsoft. Frankly, I'm surprised you had to ask.

Roy

Dec 13 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Andy Leszczynski | last post: by
42 posts views Thread by Frank Buss | last post: by
8 posts views Thread by Frank Buss | last post: by
reply views Thread by Richard Jones | last post: by
2 posts views Thread by donovan | last post: by
3 posts views Thread by Thierry | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.