你能在解决方案中混合。net框架版本吗?

时间:2020-12-30 22:44:35

Our codebase where I work is .NET 2.0. For our new assembly/DLLs/web applications I would love to take advantage of what 3.5 has to offer.

我工作的代码库是。net 2.0。对于我们的新程序集/ dll /web应用程序,我很乐意利用3.5提供的功能。

Can one mix .NET frameworks(per assembly) in a solution? Are there any IIS related caveats to this?

可以在解决方案中混合使用。net框架(每个程序集)吗?是否有与IIS相关的警告?

I would love to hear any positive/negative/howto feedback. Let me know!

我希望听到任何正面的/负面的/如何反馈。让我知道!

Thanks!

谢谢!

7 个解决方案

#1


18  

Yes you can do this in Visual Studio and it is called Multi-Targeting.

是的,你可以在Visual Studio中这样做,它被称为多目标瞄准。

Scott Guthrie has a great blog-entry on Multi-Targeting Support in Visual Studio.

Scott Guthrie在Visual Studio中有一个关于多目标支持的伟大博客条目。

VS 2008 was the first release of Visual Studio that included multi-targeting support for .NET. What this meant was that you could use VS 2008 to create and edit not only .NET 3.5 projects, but also .NET 3.0 and .NET 2.0 projects as well. This allowed developers to more quickly upgrade and take advantage of new Visual Studio tooling features – without having to necessarily require the newer version of .NET to be installed on the clients and production servers running their applications.

VS 2008是Visual Studio的第一个版本,其中包含了对。net的多目标支持。这意味着您不仅可以使用VS 2008创建和编辑。net 3.5项目,还可以创建。net 3.0和。net 2.0项目。这使得开发人员可以更快地升级并利用新的Visual Studio工具特性,而不必要求在客户端和运行其应用程序的生产服务器上安装新的。net版本。

Cheers

干杯

#2


4  

You can use 2.0, 3.0 and 3.5 together according to: http://msdn.microsoft.com/en-us/library/bb383796(v=vs.90).aspx

您可以根据:http://msdn.microsoft.com/en-us/library/bb383796(v= vs90).aspx使用2.0、3.0和3.5。

#3


3  

If you can wait for the new .NET 4.0 framework, you will be able to run dll's for each version side by side in the same process.

如果您可以等待新的。net 4.0框架,您将能够在相同的过程中并行运行每个版本的dll。

#4


3  

EDIT: I was wrong you can. You can go reference 3.+ assemblies in 2.0, because the CLR is the same. This will not be the case when going from 2.0/3.+ to 4.0 as there is a new version of the CLR.

编辑:我错了,你可以。你可以参考3。+ 2.0中的程序集,因为CLR是相同的。从2。0/3开始就不是这样了。+到4.0,因为有一个新的CLR版本。

http://abdullin.com/how-to-use-net-35-syntax-and-compiler-features-for-net-20/

http://abdullin.com/how-to-use-net-35-syntax-and-compiler-features-for-net-20/

#5


2  

This should not be an issue. .NET 2.0 RTM through .NET 3.5 SP2 all use the exact same version of the CLR. They only differ by the number of assemblies that are included. The assembly format is the same. Of course, if you do take advantage of an assembly that's only included with .NET 3.5, you must make sure that 3.5 is actually installed on the target machine. You'll find out quickly if it isn't.

这应该不是问题。net 2.0 RTM到。net 3.5 SP2都使用完全相同的CLR版本。它们只与包含的程序集的数量不同。汇编格式是相同的。当然,如果您确实利用了仅包含在。net 3.5中的程序集,则必须确保在目标计算机上实际安装了3.5。如果不是,你很快就会发现的。

3.5 should already be on the machine if it has Windows Update enabled. If not, it takes a dozen or so minutes to get it on there.

3.5应该已经在机器上,如果它已经启用了Windows Update。如果没有的话,要花十几分钟的时间才能拿到。

#6


2  

As a side note, we have some old 1.0 libraries that we used in 2.0 and still use in 3.5, without recompiling. So there's some backwards compatibility there.

顺便说一下,我们有一些旧的1.0库,我们在2.0中使用过,仍然在3.5中使用,不需要重新编译。这里有一些向后兼容性。

#7


1  

You cannot have .Net 1.1 assmeblies running in the same process as a .Net 2.0+ assembly - attempting to do so will produce a failure.

你不能让。net 1.1组件和。net 2.0+程序集运行在同一个过程中——尝试这样做会导致失败。

With regards to IIS, this means that you cannot have .Net 1.1 sites / virtual directories running in the same application pool as .Net 2.0 and above sites - you need to create a separate app pool to keep the .Net 1.1 code running in a different process. (This can only be done in IIS 6.0 and above, i.e. not in Windows XP)

至于IIS,这意味着您不能让。net 1.1站点/虚拟目录与。net 2.0及以上站点运行在同一个应用程序池中——您需要创建一个单独的应用程序池,以保持。net 1.1代码在不同的进程中运行。(这只能在iis6.0及以上版本中完成,即不能在windowsxp中完成)

However as nobugz says - .Net 2.0 through to .Net 3.5 all use the same CLR, and so different versions of .Net code can be mixed in the same assembly without worry - this also holds true for IIS (.Net 2.0 and .Net 3.5 code can happily co-exist in the same app pool)

然而,正如nobugz所说的-。net 2.0到。net 3.5都使用相同的CLR,所以不同版本的。net代码可以毫无顾虑地混合在同一个程序集中—这对IIS也是成立的。Net 2.0和。Net 3.5代码可以在同一个应用程序池*存)

#1


18  

Yes you can do this in Visual Studio and it is called Multi-Targeting.

是的,你可以在Visual Studio中这样做,它被称为多目标瞄准。

Scott Guthrie has a great blog-entry on Multi-Targeting Support in Visual Studio.

Scott Guthrie在Visual Studio中有一个关于多目标支持的伟大博客条目。

VS 2008 was the first release of Visual Studio that included multi-targeting support for .NET. What this meant was that you could use VS 2008 to create and edit not only .NET 3.5 projects, but also .NET 3.0 and .NET 2.0 projects as well. This allowed developers to more quickly upgrade and take advantage of new Visual Studio tooling features – without having to necessarily require the newer version of .NET to be installed on the clients and production servers running their applications.

VS 2008是Visual Studio的第一个版本,其中包含了对。net的多目标支持。这意味着您不仅可以使用VS 2008创建和编辑。net 3.5项目,还可以创建。net 3.0和。net 2.0项目。这使得开发人员可以更快地升级并利用新的Visual Studio工具特性,而不必要求在客户端和运行其应用程序的生产服务器上安装新的。net版本。

Cheers

干杯

#2


4  

You can use 2.0, 3.0 and 3.5 together according to: http://msdn.microsoft.com/en-us/library/bb383796(v=vs.90).aspx

您可以根据:http://msdn.microsoft.com/en-us/library/bb383796(v= vs90).aspx使用2.0、3.0和3.5。

#3


3  

If you can wait for the new .NET 4.0 framework, you will be able to run dll's for each version side by side in the same process.

如果您可以等待新的。net 4.0框架,您将能够在相同的过程中并行运行每个版本的dll。

#4


3  

EDIT: I was wrong you can. You can go reference 3.+ assemblies in 2.0, because the CLR is the same. This will not be the case when going from 2.0/3.+ to 4.0 as there is a new version of the CLR.

编辑:我错了,你可以。你可以参考3。+ 2.0中的程序集,因为CLR是相同的。从2。0/3开始就不是这样了。+到4.0,因为有一个新的CLR版本。

http://abdullin.com/how-to-use-net-35-syntax-and-compiler-features-for-net-20/

http://abdullin.com/how-to-use-net-35-syntax-and-compiler-features-for-net-20/

#5


2  

This should not be an issue. .NET 2.0 RTM through .NET 3.5 SP2 all use the exact same version of the CLR. They only differ by the number of assemblies that are included. The assembly format is the same. Of course, if you do take advantage of an assembly that's only included with .NET 3.5, you must make sure that 3.5 is actually installed on the target machine. You'll find out quickly if it isn't.

这应该不是问题。net 2.0 RTM到。net 3.5 SP2都使用完全相同的CLR版本。它们只与包含的程序集的数量不同。汇编格式是相同的。当然,如果您确实利用了仅包含在。net 3.5中的程序集,则必须确保在目标计算机上实际安装了3.5。如果不是,你很快就会发现的。

3.5 should already be on the machine if it has Windows Update enabled. If not, it takes a dozen or so minutes to get it on there.

3.5应该已经在机器上,如果它已经启用了Windows Update。如果没有的话,要花十几分钟的时间才能拿到。

#6


2  

As a side note, we have some old 1.0 libraries that we used in 2.0 and still use in 3.5, without recompiling. So there's some backwards compatibility there.

顺便说一下,我们有一些旧的1.0库,我们在2.0中使用过,仍然在3.5中使用,不需要重新编译。这里有一些向后兼容性。

#7


1  

You cannot have .Net 1.1 assmeblies running in the same process as a .Net 2.0+ assembly - attempting to do so will produce a failure.

你不能让。net 1.1组件和。net 2.0+程序集运行在同一个过程中——尝试这样做会导致失败。

With regards to IIS, this means that you cannot have .Net 1.1 sites / virtual directories running in the same application pool as .Net 2.0 and above sites - you need to create a separate app pool to keep the .Net 1.1 code running in a different process. (This can only be done in IIS 6.0 and above, i.e. not in Windows XP)

至于IIS,这意味着您不能让。net 1.1站点/虚拟目录与。net 2.0及以上站点运行在同一个应用程序池中——您需要创建一个单独的应用程序池,以保持。net 1.1代码在不同的进程中运行。(这只能在iis6.0及以上版本中完成,即不能在windowsxp中完成)

However as nobugz says - .Net 2.0 through to .Net 3.5 all use the same CLR, and so different versions of .Net code can be mixed in the same assembly without worry - this also holds true for IIS (.Net 2.0 and .Net 3.5 code can happily co-exist in the same app pool)

然而,正如nobugz所说的-。net 2.0到。net 3.5都使用相同的CLR,所以不同版本的。net代码可以毫无顾虑地混合在同一个程序集中—这对IIS也是成立的。Net 2.0和。Net 3.5代码可以在同一个应用程序池*存)