实现一个.NET项目目标是包括3.5和4.0 [英] Implement a .Net project targeting both 3.5 and 4.0

查看:161
本文介绍了实现一个.NET项目目标是包括3.5和4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个项目(登录LIB)所使用的标准asp.net应用程序(4.0框架)以及通过SharePoint解决方案(3.5框架)。

We have a project (logging lib) that is used by standard asp.net apps (4.0 framework) and also by sharepoint solutions (3.5 framework).

有没有办法来定义,这样,当我们所建立的项目两个版本被内置两个目标?

Is there a way to define both targets so that when we build the project both versions gets built?

此外,如任何人实施这样的事情,并通过的NuGet分发?什么是对的NuGet发布两个版本的最佳方法?

Also, as anybody implemented something like this and distribute it via nuget? What's the best approach to publishing both versions on nuget?

感谢

推荐答案

答案是 < supportedRuntime> 的配置元素。这使您可以指定所有.NET运行时将您的应用程序能够支持和下运行。当然,在您的应用程序只能使用功能的.NET框架的所有您所选择的版本提供。

Answer is <supportedRuntime> config element. This allows you to specify all .NET runtimes your application can support and run under. Of course, in your application you can only use functionalities that all your chosen versions of .NET framework provide.

总之,你应该有这个在你的配置:

In short, you should have this in your config:

<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

这可能是必要的最初目标应用程序到.NET 3.5的&LT; supportedRuntime&GT; 允许上浮的版本,而不是往下走。

It might be necessary to originally target your application to .NET 3.5 as <supportedRuntime> allows to go up in versions rather than go down.

这篇关于实现一个.NET项目目标是包括3.5和4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆