views:

245

answers:

4

I have a web application that I expect to intergrate features in assemblies from two separate providers. One set (Set1) of assemblies is build on .NET 2.0 while the other set (Set2) of assemblies ABSOLUTELY requires .NET 3.5. For Set2 assemblies to work, I have to add a (system.codedom) section to web.config and specify the v3.5 compiler. However, that seems to break code referencing Set1 assemblies (the JIT compiler takes forever and request times out). When I remove the system.codedom section, some features of the application referencing Set2 fail.

We started this project with the knowledge that .NET 2.0 and 3.5 can coexist without any problems. Is there any way of making these two sets of assemblies play nicely?

EDIT: Here is what the system.codedom section looks like;

  <system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="WarnAsError" value="false"/>
  </compiler>
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="OptionInfer" value="true"/>
    <providerOption name="WarnAsError" value="false"/>
  </compiler>
</compilers>

+1  A: 

If your application domain is initiated in .NET 2.0, only .NET 2.0 assemblies will be able to load. If your application domain is initiated in .NET 3.5, you will be able to load .NET 2.0 and .NET 3.5 assemblies without any problems.

So, let's say for example that you create a Windows Application Project and you set your target to .NET 2.0, you will not be able to load .NET 3.5 assemblies. If you target your project to .NET 3.5, 2.0 assemblies and 3.5 assemblies will load without any problems.

Andrew Moore
But what about the system.codedom thing?
Robert Harvey
It doesn't matter. It seems that Set1 cannot be recompiled in .NET 3.5 and it is Set1 that calls Set2. Unless either Set1 gets recompiled in .NET 3.5 or that Set2 gets recompiled in .NET 2.0, I don't see it happening.
Andrew Moore
To clarify, the two sets of assemblies do not call each other, its the code in App_Code and aspx pages that references both sets of assemblies.
deverop
Check your top level callee (the one that initiates the AppDomain) and if you can make that code target .NET 3.5.
Andrew Moore
so say I add a line in Global.asax (Application_Start), to call some .NET 3.5 feature, that would probably fix it?
deverop
Unfortunately I don't know enough about ASPX versus WinForms to answer your question.
Andrew Moore
Also, since the problem seems to be occurring during compile, we may not have even reached the top-level callee yet...
deverop
A: 

There is no "3.5 runtime" for .NET web applications (ASP.NET). ASP.NET 3.5 apps run on the 2.0 runtime, and the 3.5 "stuff" is just added libraries that have to be installed on the machine.

Are you sure that 3.5 has been installed on the server where this is running?

Are you recompiling your own web application? Or just changing the config file? What type of project is your app? Web site project? Web application project?

daughtkom
Its a web site project and the code being compiled is the App_Code and aspx codebehind
deverop
A: 

The CLR has not changed between 2.0 and 3.5 - the core BCL also hasn't. 3.0 and 3.5 only add new stuff - they should be completely compatible with 2.0.

See link for more info (red/green bits).

Remi Lemarchand
That's what I thought too! Now to figure out where else the problem could be originating.
deverop
A: 

I've had the same thing happening, but that was when running a beta version of .net 3.5 / vs2008. As said before, 3.5 is just an "add-on".

Colin