Shared Code for Compile on Demand

G

Guest

I have a quick question about asp.net 2.0 compile options.

Here's the scenario: I want to share some code among several websites on the
same server, but I don't want to precompile anything.

The classic ASP directory structure would look like this.

Physical files -> IIS Paths
c:\wwwroot\website1 -> http://website1
c:\wwwroot\website2 -> http://website2
c:\wwwroot\common -> <none>
c:\wwwroot\common -> http://website1/common
c:\wwwroot\common -> http://website2/common

Using this approach works fine in ASP.NET 2.0 until you need to use the
App_code directory.

I tried splitting up the common project like this.

c:\Common\<projectRoot>
c:\Common\App_Code\Base_App_Code
c:\Common\Common

Then I set up parallel virtual directories in the inheriting websites and
added the following to the config...

<compilation debug="true">
<codeSubDirectories>
<add directoryName="Base_App_Code"/>
</codeSubDirectories>
</compilation>

....but IIS/ASP.NET didn't like the fact that Base_App_Code was a virtual
directory (Application or plain)

Is there an alternate approach?
...Trigger an msbuild task with the compilation config section?
...Compile the common project with a custom build provider?
 
S

Steven Cheng[MSFT]

Hi Jedatu,

Thank you for posting.

Regarding on the shared source compilation problem, I'm afraid this is
limited by the current compilation model of ASP.NET application. The
dynamic compilation is limited in the application's own dir and is based on
physical folder hierarchy. This is the same as the private assembly probing
in the "bin" dir(which also must be a physical sub dir). So currently for
shared code among multiple ASP.NET applications on the same server, we
suggest you still use assembly level sharing (precompiled and put in GAC),
this is the recommended approach.


Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hey Steven,

Do you think creating a junction would hurt anything?

http://www.sysinternals.com/Utilities/Junction.html

The "Virtual Directory" is at the operating system level so IIS is
non-the-wiser. My initial tests seem to work fine.

c:\Common_App_Code
c:\...\MyApp1\App_code\Common_App_Code -(junction)> c:\Common_App_Code
c:\...\MyApp2\App_code\Common_App_Code -(junction)> c:\Common_App_Code
 
S

Steven Cheng[MSFT]

Hi Jedatu,

This sounds cool.:) So far I haven't found any obvious on this approach.
Since this symlink perform redirection at NTFS level, ASP.NET won't detect
the difference. However, make sure you only use it for source code dir, do
not use them for share any generated assembly since those generated
assembly or other resource will contain application specific info.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top