Convert "App_Code" to DLL ?

  • Thread starter Thread starter Jethro
  • Start date Start date
J

Jethro

Hi guys,

I have inherited a .NET 2.0 web project. It consists of a root site,
and 3 sub directories.

Ideally these are seperate projects/websites. The root is a customer-
facing one, and the other 3 are for admin, and supervisor use.

I want to break the existing project (all websites treated as one)
into 4 separate websites.

Unfortunately they all share the "App_code" directory, which contains
common classes to all 4 sites.

Can anyone advise on how I can make the App_code a shared component in
4 websites, so that I can rebuild the entire app as 4 projects, which
will speed up development, and make it more robust (90% of development
and fixes go into the public site, why rebuild the other 3 every
time ?

Thanks in advance, guys.
 
Create a new class library project (in the appropriate language) and copy
the App_Code files into that project. Run it until you can compile, as there
may be some web libs you need to reference, esp. if there is not a good
separation of concerns (likely considering you have library material in
App_Code).

After it compiles, take one of the websites and exclude everything in the
App_Code folder that you have moved. Make a reference to the new library.

Now go through and correct the using (C#) or Imports (vb) statements for
your project. Once you have a compile, consider it a test build and have
someone from QA (if you have QA) test that build thoroughly. Consider it
suspect, because someone may have tied in some config elements that are not
pulling properly into the lib, etc.

As it is being tested, go to another site and do the same. Rinse and repeat
until all sites are thoroughly clean and tested. Then, go back and delete
the excluded files.

NOTE: If you are using source control (you are, right), you can branch the
build before doing the switcheroo and delete instead of exclude at the first
step. It is unlikely you are going back. But, if you are, you still have the
old branch to go back to.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Thanks a million, it worked ! Great !! almost there. One last
question ...

One of the main apps files was "Webservice.asmx" which contained only
the following line :

<%@ WebService Language="VB" CodeBehind="App_Code/WebService.vb"
Class="WebService" %>

now as it happens it's only the Main app which uses this file, so
there's no issue with putting it back into App_Code, and letting the
thing build, However, as an academic excercise, is there a way to
redirect it to look in my shiny new DLL ?

thanks in advance
 
Yes.

Do this. Run a publish of a site, clicking the first three checkboxes (not
100% sure the last part is necessary, but that is how I have it set). Then
examine the ASMX file. When you publish it changes the directive to look at
the DLL instead of a code file. Use the example as a cheat sheet to do what
you desire.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Back
Top