Craig Hunt

.NET (C#) and whatnot
posts - 11, comments - 8, trackbacks - 9

My Links

News



Archives

VS.NET

Migrating to ASP.NET 2.0

I just upgraded my site's bits to .NET 2.0. It was deceptively simple. However, when I went to deploy my latest bits to test, things stopped making sense. From a VS.NET 2003 / .NET 1.1 frame of reference, that is.

When I look at the properties of my web site project in VS.NET 2005, I don't see any output information? When I right-click on my site project and click “Build Web Site“ where is my site DLL being built? I don't see anything going into bin...

Let's say you deploy the site the same way you did with VS.NET 03 and .NET 1.1. You will likely get an error like:

Parser Error Message: Could not load type 'blah.Global' or Could not load type '_Default'

As far as I can tell, this is the deal. You have two options: You can compile at runtime only or you can “pre-compile.“ The first option is done by using src=”YourFile.cs” or putting your code “inline” usng the <script runat=server /> tags. Both options for compiling at runtime only are equally stupid, so don't consider either one in a production environment. There are lots of reasons why compiling at runtime only is stupid, but the main one is that if there are problems with your code you want to know before it gets to production.

You can precompile a few ways. You can either use \<windir>\Microsoft.NET\Framework\v2.XXX\aspnet_compiler.exe directly, or you use VS.NET 2005, which in turn will use aspnet_compiler.exe. I am guessing MSBuild also uses aspnet_compiler.exe, but I haven't tried it yet. To precompile using VS.NET, right-click on your site in the Solution Explorer and choose “Publish Web Site.“ You can publish to an FTP site, but when I tried my VS.NET froze solid and I had to use Task Manager to blow it away. Now, I “publish“ to another directory and use Beyond Compare to migrate my changes.

Hopefully this will help clarify what is going on for someone else running into the same issue.

Print | posted on Monday, November 21, 2005 7:04 PM |

Feedback

Gravatar

# re: Migrating to ASP.NET 2.0

just put the global.asax and global.asax.cs under App_Code folder. that worked for me.
1/15/2006 12:26 PM | ali
Gravatar

# re: Migrating to ASP.NET 2.0

Ali,

In my humble opinion, I see two issues with that.

First, you're deploying source code. While that may be convenient, you should really strive to only deploy the bits. I can provide many reasons why I feel this way if you're interested.

Second, when the source is deployed, compilation doesn't happen until someone loads a page...a bad time to learn there are compiliation issues.

I will admit there are ways to mitigate both issues above, but what a pain! Let's not revert to classic ASP style programming.
1/16/2006 1:01 PM | Craig
Gravatar

# re: Migrating to ASP.NET 2.0

You Need to Run Aspnet_regiis.exe -i for asp.net 2.0 version
1/16/2006 8:00 PM | Santa
Gravatar

# re: Migrating to ASP.NET 2.0

Santa,

Good point. I guess perhaps I should have named the post "ASP.NET changes in VS.NET 2005" (or whatever) because I wasn't trying to document all the steps involved in migrating to 2.0. I was simply trying to point out a difference in the way the binaries are built.
1/16/2006 8:36 PM | Craig
Gravatar

# re: Migrating to ASP.NET 2.0

As far as MSBuild goes, you can't directly run it on a web project. There's no build file to point MSBuild at. (You CAN run msbuild on a solution file containing a web project, though).

For our purposes we found that using the Web Deployment Project plugin from www.asp.net (it's from Microsoft, so it's "official" but in beta) worked best. It creates a second project that includes a .wdproj MSBuild file, that launches the aspnet_compile program on your web site and deploys it to a secondard location. This is basically what VS2500 does but you can use the .wdproj to build from, for example, NAnt or a makefile.
1/23/2006 7:47 AM | Mike Edenfield
Gravatar

# re: Migrating to ASP.NET 2.0

Good info, Mike. Thanks.
1/23/2006 10:55 AM | Craig
Gravatar

# re: Migrating to ASP.NET 2.0

Hi Gyanendra,

Please send the details to craig AT patternistic.com and if I can help, I will. However, as a shot in the dark, make sure you've done the following (as Santa noted above):

* open a command prompt

* type: chdir /d "C:\Windows\Microsoft.NET\Framework\v2.0.50727" (if this is different on your box, adjust as necessary)

* type: aspnet_regiis.exe /?

* review the options and then execute the appropriate command + switches (like Santa noted often this is aspnet_regiis.exe -i)

Essentially this process is telling IIS to use the 2.0 ISAPI dll for all the appropriate sites. Otherwise, the 1.1 ISAPI dll will choke on 2.0 bits at runtime.
12/31/2007 9:33 AM | Craig
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: