简体   繁体   English

在框架3.5和4.0中进行VS2012项目构建

[英]VS2012 project building in both framework 3.5 and 4.0

I have a custom dll that I created for an internal application that we use here at work using .Net framework 4.0. 我有一个为内部应用程序创建的自定义dll,我们在使用.Net framework 4.0时在这里使用它。 There is a need to use the same dll within our website, however, our website is set to .Net Framework 3.5 and at this time cannot be upgraded to 4.0 as there are multiple other dlls that the website uses that would not be compatible with 4.0. 有必要在我们的网站中使用相同的dll,但是,我们的网站设置为.Net Framework 3.5,并且由于该网站使用的其他多个dll与4.0不兼容,因此目前无法升级到4.0。 。 Is there a way to build a dll for multiple .Net Frameworks and if so how? 有没有一种方法可以为多个.Net Framework构建dll,如果可以,怎么办? I cannot seem to find a way to do this. 我似乎找不到解决办法。

You can build you custom dll to target .Net 3.5. 您可以构建自定义dll来面向.Net 3.5。 Your web site will then be able to use it. 您的网站将可以使用它。 Your newer projects (that target a higher version of the .Net framework) can still use your custom dll. 您较新的项目(针对更高版本的.Net框架)仍可以使用自定义dll。

You can set the target in the Project's Properties page. 您可以在“项目”的“属性”页面中设置目标。

Based on the csproj file for .NET 4 to create a copy that targets .NET 3.5. 基于.NET 4的csproj文件,创建针对.NET 3.5的副本。 Then .NET 4 projects add the original one as reference, while .NET 3.5 projects use the new one. 然后.NET 4项目将原始项目添加为参考,而.NET 3.5项目使用新项目。

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

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