简体   繁体   English

Dotnet 4.0从2.0升级

[英]Dotnet 4.0 upgrade from 2.0

i am working on a dotnet C# web application which was initially created with VS 2003. My goal is to upgrade this application to Dotnet 4.0 without changing any functionaltiy. 我正在使用最初由VS 2003创建的dotnet C#Web应用程序。我的目标是在不更改任何功能的情况下将该应用程序升级到Dotnet 4.0。 The solution has 9 projects (1 web + 8 Library projects). 该解决方案有9个项目(1个Web + 8个图书馆项目)。 The Web project refers the 8 libraries in DLLs. Web项目引用DLL中的8个库。 To start off, I created a New project in VS2010 and added the all the Project files from the existing source code. 首先,我在VS2010中创建了一个新项目,并添加了现有源代码中的所有Project文件。 Every time i add a project file to my solution, i was prompted with the Converison wizard and i completed the conversion wizard succesfully and now the solution works fine. 每次我向解决方案中添加项目文件时,Converison向导都会提示我,并且成功完成了转换向导,现在解决方案可以正常工作。 After the conversion, i noticed that Except the "Web" project, other projects are converted to Dotnet 2.0 but not 4.0. 转换后,我注意到除“ Web”项目外,其他项目都转换为Dotnet 2.0,而不是4.0。 My application runs without error if i run it locally using VS2010. 如果我使用VS2010在本地运行,则我的应用程序运行不会出错。 My questions are 我的问题是

  1. Why the Class libaray project did not upgrade to 4.0? 为什么Class libaray项目没有升级到4.0? Currently the Web project is shows up as Dotnet 4.0 and Libaray projects shows up as Dotnet 2.0. 当前,Web项目显示为Dotnet 4.0,而Libaray项目显示为Dotnet 2.0。
  2. Can i deploy the application to IIS 7.0 with the Dotnet runtime of 4.0? 我可以使用4.0的Dotnet运行时将应用程序部署到IIS 7.0吗? Will the Dlls created in version 2.0 work if my application uses Dotnet 4.0 runtime version? 如果我的应用程序使用Dotnet 4.0运行时版本,在2.0版中创建的Dll是否可以正常工作?

Please help... 请帮忙...

If your'e migrating now, why not move directly to Visual Studio 2012, instead of 2010? 如果现在要迁移,为什么不直接迁移到Visual Studio 2012,而不是2010?

Anyway, what you can do is open the project properties in each of your projects, and change the target framework to the .NET framework 4.0. 无论如何,您可以做的是在每个项目中打开项目属性,然后将目标框架更改为.NET Framework 4.0。

Then if you get any compilation error you can probably easily solve it individually. 然后,如果您遇到任何编译错误,则可以轻松地单独解决它。 This should be relatively easy if your projects are not too big. 如果您的项目不太大,这应该相对容易。

As for your specific questions: 至于您的具体问题:

  1. The automatic conversion would only change the format of the solution/projects to be compatible with the new version Visual Studio. 自动转换只会更改解决方案/项目的格式,以与新版本的Visual Studio兼容。 It shouldn't change the target framework but you can change that yourself. 它不应更改目标框架,但您可以自己更改。

  2. Yes, assemblies targeting .NET 2.0 can be loaded and used from assemblies targeting .NET 4.0. 是的,可以从面向.NET 4.0的程序集中加载和使用面向.NET 2.0的程序集。

1) Upgrading the solution/projects file only upgrades it's format so you can open it in VS 2010. It will usually leave the targeted .NET setting at the previous value. 1)升级解决方案/项目文件只会升级其格式,因此您可以在VS 2010中打开它。通常,目标.NET设置将保留为先前的值。 These are two seperate things. 这是两件分开的事。 The wonderful thing about VS 2010 is it let's you target whatever version of .NET you desire, so no longer do you need multiple version of VS installed to support differnt .NET versions. VS 2010的妙处在于,您可以将所需的.NET版本作为目标,因此不再需要安装多个VS版本来支持不同的.NET版本。 It didn't change the targetted .NET version because it leaves it up to you. 它没有更改目标.NET版本,因为它由您自己决定。 You can change it under the project settings and recompile your library projects to regenerate the DLLs 您可以在项目设置下更改它,然后重新编译您的库项目以重新生成DLL。

2) You will need an application pool for .NET 4. .NET is backwards compatible in that a .NET 2.0 app can run on a machine with .net 4 installed. 2)您将需要一个.NET 4应用程序池。.NET向后兼容,因为.NET 2.0应用程序可以在装有.net 4的计算机上运行。 However, the application pool for 2.0 applications must be separate from 4.0 apps. 但是,用于2.0应用程序的应用程序池必须与4.0应用程序分开。 So it's just a matter of putting the app under the right app pool. 因此,将应用程序置于正确的应用程序池中只是一个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM