Using .NET 3.5 Assembly with ASP.NET 2.0 project - asp.net

I inherited some .NET projects from a colleague who left our company a while ago. One of them is a web portal on ASP.NET (with 2.0 Framework), another is a helper library defining the controls we are using (derived from System.Web.UI.User) and some other helpers. This library uses some classes only available to .NET 3.5.
My predecessor somehow managed to use this 3.5 assembly in the 2.0 web project, but now I had to add some functionality to it and wasn't able to do it again.
(note: the alternative way to upgrade the web project to 3.5 framework caused some other problems I couldn't solve by now)

Related

why Web Forms 4.0 can use a .NET2.0 library [duplicate]

This question already has an answer here:
Is there any difference between .NET 2 and .NET 4 assemblies running under .NET 4
(1 answer)
Closed 6 months ago.
Summary
I am maintaining a ASP.NET Web Forms 4.0 VB.NET project at my company
image from project's web.config
Because of Improper Handling of Exceptional Conditions in Newtonsoft.Json
I need to upgrade the version of Json.NET to 13.0.1 about
ASP.NET Web Forms 4.0 VB.NET project
the JsonNet version in Web Forms project's Bin folder is .NET2.0 & 8.0.3.(the project I am maintaining)
I found that you can replace the Newtonsoft.Json.dll with new dll(.NET4.0 & 13.0.1) straightly on the old Web Forms 4.0 project on IIS server.
And the original version is .NET2.0 & 8.0.3.
No error result, the porject runs well
I feel the two version are compatible
My problem is why web forms 4.0 can use a NET2.0 dll?
Other
this is what I had dowmloaded from Json.Net github source code.
And this is the all .NET version of the 13.0.1 version Json.NET
tree structure
.NET framework are version compatibility
So .Net framework 2.0 library should work fine on .Net framework 4.0
Also can see Side-by-Side Execution in the .NET Framework
some basic of Web Forms
According to What is Web Forms
ASP.NET Web Forms are:
Based on Microsoft ASP.NET technology, in which code that runs on the server dynamically generates Web page output to the browser or client device.
Compatible with any browser or mobile device. An ASP.NET Web page automatically renders the correct browser-compliant HTML for features such as styles, layout, and so on.
Compatible with any language supported by the .NET common language runtime, such as Microsoft Visual Basic and Microsoft Visual C#.
Built on the Microsoft .NET Framework. This provides all the benefits of the framework, including a managed environment, type safety, and inheritance.
Flexible because you can add user-created and third party controls to them.

Using ASP.NET MVC 4 and Web API components within a .NET f/w 4.0 and VS2010-constructed app

I'm a little confused about one thing with version levels of various .NET software components related to ASP.NET MVC and the web api. Now I know VS2012 and .NET f/w 4.5 are going RTM "real soon now", but I don't want to make that up-transition for awhile (as in 6 months or longer). I am coding a new app right now whose initial incarnation (dictated by consulting client) has to be .NET f/w 4.0 and utilizing VS2010 (yes I know you can target downwards with VS2012 but that is not an option for me in this case - as a consultant you are sometimes dictated the tools/versions etc that you MUST use for a contract). So finally to the crux of my question - I just came across an article on MSDN by Mike Wasson, written in Jan/Feb 2012 timeframe, and it looks as if he used VS2010 and .NET f/w 4.0, but demonstrating the new-ish Web API technology utilizing ASP.NET MVC 4. So it IS possible to install the ASP.NET MVC 4 component within the context of .NET f/w 4.0 and VS2010, AND utilize the Web API component? Which, if that is true, I might want to do with this particular project rather than just using ASP.NET MVC 3 (and without using the Web API stuff at all), which is what i thought I would need to do. It's just that I thought to use ASP.NET MVC 4 and/or the Web API stuff, one HAD to use .NET f/w 4.5 RC and VS2012 RC prior to Sep 12 (or their RTMs after Sep 12). Is that not correct?
You can use mvc 4 and web api with .net 4.0. You cannot use features of .net 4.5 in it but all other will work.
So it IS possible to install the ASP.NET MVC 4 component within the
context of .NET f/w 4.0 and VS2010
Of course. It's RC at the time of this writing but you could download and install it from here: http://www.asp.net/mvc/mvc4 (Download the standalone installer executable for VS2010 from here: http://www.microsoft.com/en-us/download/details.aspx?id=29935)
Even when it hits RTM you will be able to use it with VS2010. Of course you won't be able to use .NET 4.5 speicic features with VS2010 though (things like async/await).

ASP.NET 2.0 Website uses .NET framework 3.0 DLL

We are developing ASP.NET site in VS.NET 2005. This site is will be hosted on server which has .NET 3.0 installed and in IIS, ASP.NET 2.0 would be selected under ASP.NET tab.
We would use external DLL which is being developed in VS.NET 2008 with .NET 3.0 as taraget framework. Here they are using .NET 3.0 / C# 3.0 features such as Lamda expressions.
Now, the question is,
1) If we were not using this external DLL (.NET 3.0 as taraget framework), which .NET framework version it would use for this site? Since in this case only .NET 2.0 DLLs are referenced, I think it should use 2.0 framework only.
2) In current case where we are using this external DLL (.NET 3.0 as taraget framework), will it load both framework in memory for this website or just highest version i.e. .NET framework 3.0?
3) Are there any side effects in this case because the application (website) DLL would ask loader to load .NET framework 2.0 and one of the extrenal DLL, the main application requires is in .NET 3.0. Is is possible that .NET 2.0 will be loaded first for the application but when application references external DLL, .NET 3.0 framework will be loaded?
4) Is there any difference if
the external DLL developed in .NET 3.0 as taraget framework was refereced as "Add Reference" using VS.NET 2005
the external DLL developed in .NET 3.0 as taraget framework was just copied into bin folder of application (website)
5) If it depends on what features are used in .NET 3.0 framework, please provide details in both cases; when those features used and those features are not used.
.Net 3.0 is an extension of .Net 2.0. There is no "replacement" of the framework DLLs when you use .Net 3.0 because it is composed of the same libraries, plus some additional DLLs for the added functionality. Think of the extra .Net 3.0 DLLs as additional, external functionality that is only loaded as needed.

Scriptmanager not supporting for .net 2.0

I am deploying a website which is developed in 3.5 framework.Server only support 2.0.
hence i recompliles the same project by changing the target framework.
But there is a scriptmanger in my website. which is not supporting 2.0 framework...
is there any work around for this?
ASP.NET 2.0 does support the use of AJAX, you just have to change the referenced assembly information. You can get the needed files from the ASP.NET site here.

Can you make a site with ASP.NET MVC Framework using .NET 2.0?

Is it possible to make a site with ASP.NET MVC Framework using .NET 2.0? I am limited to using .NET 2.0 (we use VS 2008, but we have to use the 2.0 Framework) and I really want to try out the MVC Framework.
Scott Hanselman described a way to make it work, with some caveats, in his blog:
Deploying ASP.NET MVC on ASP.NET 2.0
It can be done using Visual Studio 2008, but it can cause headaches...
Create an ASP.NET MVC Web Application
Set Project Target Framework to 2.0
in Project Properties
Add a references to System.Web.MVC (click through warning messages)
Add any additional references you may need (System.Web.Routing, System.Web.Abstractions) again clicking through any warning messages
Start coding!
Not everything you try will work, if you see errors like this on deployment it means that whatever you are doing isn't supported by the 2.0 framework...
"The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)"
Configure your IIS to support MVC Routes and extensions
Copy "C:\windows\assembly\GAC_MSIL\System.Core" from the .NET 3.5 development framework to the /bin folder of the IIS Server running .NET 2.0 SP1.
Much of this can be found in a lot more detail on Scott Hanselman's blog

Resources