ASP.NET 2.0 Website uses .NET framework 3.0 DLL - asp.net

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.

Related

Upgrading Web Forms ASP.Net 3.5 to 4.7

We have a web forms project that is running on ASP.Net 3.5 and we need to upgrade all the way to 4.7. Telerik controls are involved which I know will need to be upgraded as well. This is a large web application and I know there is not quick solution, but trying to figure out how to get started. Does anyone have any recommendations for such a task.
It depends on the CLR for the .Net framework you are using.
.Net Framework 2.0, 3.0, and 3.5 uses CLR 2.0
.Net Framework 4, 4.5, and 4.5.1 uses CLR 4.0
CLR 3.0 does not exist
An application developed in .Net 2.0 or 3.0 can run in a 3.5 framework because the target CLR is the same
But an application developed in .Net 3.0 will not run in a 4.5 framework because now the target framework is different (CLR 4)
Solution
To configure your application to run on .Net Framework 4 or 4.5:
Create a text file that has the same name as your application, and add the file extension .config. For example, if your application is named abc.exe then your application configuration file must be named abc.exe.config.
Add the element as follows to the application configuration file:
`<configuration>
<startup>
<supportedRuntime version="version"/>
</startup>
</configuration>`
Check framework upgrade guidelines here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/d4c6adee-4dd5-435d-a021-4fd9d4c6f7c0/net-framework-upgrade-from-35-to-471?forum=netfxsetup

.NET Core and .NET Framework 4.7 edit project option not available

When I create a .NET Core 2.0 Project I have to select both .NET Core version (2.0) and a .NET Framework version (4.7). But when I edit the project, I cannot change the .NET Framework version. Why is that? I am trying to use the function app.UseRewriter(options); and it is unavailable so I am theorizing that I have the wrong .NET Framework
I guess I just needed this package
Install-Package Microsoft.AspNetCore.Rewrite -Version 2.0.1
Yes, that's a confusing GUI. That got me mad as well (like some other stuff in Visual Studio if you are used to Jetbrains-IDEs).
You have chosen an ASP.NET Core Web Application as project type. So the only target frameworks that are being offered to you are .NET Core 1.0, 1.1 and 2.0 (in case you have installed 2.0, like you did).
Chose Web -> ASP.NET Web Application (.NET Framework) to get what you want.

ASP.NET Web API on .net 4.0

I have ASP.NET web api project created on .NET v 4.5
I later i was decided to change framework to 4.0
After changing i got an error. VS can not regognize types and namespaces althougt all required librariesare referenced.
It does not happen to newly creted test API project.
Try to check that the dlls you are referencing are for version 4.0 and not 4.5, could be you are still referencing 4.5 libraries which won't work with .net 4.

Will the MVC 2.0 assemblies compiled against 3.5 and 4.0 live side-by-side in the GAC?

We are upgrading some of our VS2008 solutions to VS2010, but we are not yet prepared to go to .NET 4.0 on all our projects. At the same time, we are looking at a move from MVC 1.0 to 2.0. I know that there are MVC 2.0 assemblies/code compiled against both the 3.5 and 4.0 .NET Frameworks, but will these two MVC versions live side-by-side in the GAC of a single machine? Meaning, can I deploy both an MVC 2/.NET 3.5 site and also an MVC 2/.NET 4 site on the same server, provided that the server has both frameworks installed and I have run both the "MVC 2 2008" and "MVC 2 2010" installers?
There is only a single System.Web.Mvc.dll v2 assembly, and it is compiled against .NET 3.5. (Though it will also run correctly on .NET 4.) The end result is that if you have MVC v2 GACed, it will automatically operate correctly on both ASP.NET 3.5 and ASP.NET 4 sites.
The only thing you need to worry about is if you are putting your own assemblies in the gac, and you have the same dll in both .net 4 and 3.5. If so just use different version numbers and different snk.

aspnet command line tools location

Microsoft provides a number of command line tools for working with asp.net applications. I haven't had any trouble using these tools. One thing that I can not understand though, is the location of these tools.
Even for applications targeting newer versions of .net, these tools are located in the .net v2 directory. On my machine, that's C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727. Why do these tools not exist in the v3.0 or v3.5 directories? And why do the ones in the older directory work on the newer framework?
This is more of an idle curiosity than required knowledge for me, but I would like to know.
Update:
Thanks for the good answers everyone. These answers raise a new question though. I hope you will forgive me for asking it here, since it is so highly related. If .net 3.5 is really just using the CLR from 2.0, why is 2.0 compatible with Windows 2000, but not 3.5? It would seem to me that if the updates in 3.0 and 3.5 run inside the framework of the earlier version, then they must maintain compatibility with the same platforms as the earlier version too. Why is this wrong?
.NET 3.0 and 3.5 are (basically) just library additions to the 2.0 framework.
The addition of .NET 3.0 didn't mean new compilers or a new CLR. Instead, it's three major new libraries: WCF (Windows Communication Foundation née Indigo), WPF (Windows Presentation Foundation née Avalon) and Windows Workflow or WF.
Basically, remember Framework version != CLR Version. If you configured an IIS Application to use .NET 2.0, you're talking about the 2.0 CLR. WCF Applications use the .NET 2.0 CLR with the new 3.0 WCF libraries.
* .NET Framework 1.x = CLR 1.x
* .NET Framework 2.0 = CLR 2.0
* .NET Framework 3.0 = CLR 2.0
* .NET Framework 3.5 = CLR 2.0 + (C# 3.0 | VB9)
Edit:
To answer your second question, .NET 3.0 and 3.5 have new libraries which reference OS-level features like WPF, which isn't available on Windows 2000. If you write an application in 3.5* but only use functionality and libraries that were also available in 2.0, it can still work on Windows 2000.
*by "in 3.5", we mean write it in Visual Studio 2008 under 3.5 but set your Project Target Framework to 2.0. Scott Hanselman talks about doing this to get ASP.NET MVC to work on .NET 2.0.
It is because the core of .Net has not actually been changed since v2.0. MS marketing types were much derided at the time for forcing the naming scheme in use, where .Net 3, and .Net 3.5 are really just adding additional libraries that run on the .Net 2 core.
Check out Scott Hanselman's blog post for more details.
Because .NET 3.0 and 3.5 are applications of .NET 2.0, not complete, standalone frameworks unto themselves. This is further see in the IIS config, where you only have the option to select .NET 1.0, .NET 1.1, and .NET 2.0. You web.config file will include any .NET 3.0 or .NET 3.5 assemblies as these are written, ultimately, with .NET 2.0 code. More details about that can be seen here: http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx
Of course, that all changes in .NET 4.0 which will be a completely "new version" of the framework.
v3.0 and v3.5 still uses the v2 DLLs for the core files. Most of the changes are additions to the v2 framework as well as a new compiler for 3.5.

Resources