2

I am trying to target multiple .net frameworks for the same output build (exe).

<?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> 

My application works with 2.0 3.0 3.5 and I want to target all in my application.

Any idea?

mins
  • 6,478
  • 12
  • 56
  • 75
Nikita Tracy
  • 31
  • 1
  • 3
  • Why do you want to target multiple versions? If you just want your assembly to be compatible with each version, build it for .NET 2.0 and it will work with higher versions. If you want to generate several EXEs, each of which targets a different version, there are some strategies for doing so but it is much more complicated. – BJ Myers Mar 24 '15 at 23:27
  • because some people dont have 2.0, example if i build it for 2.0 and user having 4.0 only then its not working. (i tried it already on a pc that was having 4 only) – Nikita Tracy Mar 24 '15 at 23:31
  • possible duplicate of [How to target multiple versions of .NET Framework from MSBuild?](http://stackoverflow.com/questions/2923181/how-to-target-multiple-versions-of-net-framework-from-msbuild) – BJ Myers Mar 24 '15 at 23:35
  • i checked this link already, but this create multiple exe's i want it to run with one exe – Nikita Tracy Mar 24 '15 at 23:38
  • 3
    A single executable cannot target different versions of the .NET framework. – BJ Myers Mar 24 '15 at 23:39
  • project groups, nuget restore, and nuget ref groups, nice solution: https://shazwazza.com/post/Multi-targeting-a-single-Net-project-to-build-for-different-framework-versions – OzBob Feb 21 '17 at 03:18

0 Answers0