如何针对同一构建多个.net框架

问题描述:

我想针对同一个输出构建(EXE)多个.net框架。如何针对同一构建多个.net框架

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
<PropertyGroup> 
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 
<ProductVersion>9.0.30729</ProductVersion> 
<SchemaVersion>2.0</SchemaVersion> 
<ProjectGuid>{B4436616-28A2-4B98-9C39-3DA4AC95537E}</ProjectGuid> 
<OutputType>WinExe</OutputType> 
<AppDesignerFolder>Properties</AppDesignerFolder> 
<RootNamespace></RootNamespace> 
<AssemblyName></AssemblyName> 
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 

我的应用程序与2.0 3.0 3.5一起工作,我想在我的应用程序中的所有目标。

有什么想法?

+0

为什么你想要定位多个版本?如果你只是想让你的程序集与每个版本兼容,那么为.NET 2.0构建它,它可以与更高版本一起工作。如果你想生成几个EXE,每个EXE都以不同的版本为目标,有一些策略可以这样做,但它要复杂得多。 – 2015-03-24 23:27:53

+0

,因为有些人没有2.0,例如,如果我建立它为2.0和4.0的用户只有它不工作。 (我试过它已经在只有4个电脑) – 2015-03-24 23:31:37

+0

可能重复[如何从MSBuild目标多个版本的.NET Framework?](http://*.com/questions/2923181/how-to-target -multiple-versions-net-framework-from-msbuild) – 2015-03-24 23:35:37

Version Compatibility in the .NET Framework 你应该看看这个。 如果您的应用程序未使用.net的某些特定未来版本,则此版本不同,您不需要3个版本。

+0

我应该目标,因为我有2 ddl的一个为dotnet 4和其他为2和3.5 – 2015-03-24 23:32:46

+0

你需要添加你的DLL像一个解决方案中的不同项目。并在项目设置框架版本。 – Victor 2015-03-24 23:49:14