1

I'm trying to build a project for several versions of the .Net Framework

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\net45</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5.1|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\net451</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>

When I build the project with MSBuild and look at the produced assemblies in dotPeek i get the following results

v4.0 gives me .Net Framework v4.0
v4.5 gives me .Net Framework v4.5
v4.5.1 gives me .Net Framework v4.0

How come targeting 4.5.1 gives me .Net Framework v4.0 I would think it would at least be 4.5, am I missing anything?

Please tell me if you need more information!

2
  • There crucial info missing from this question, the IDE doesn't support this kind of hanky-panky. The target framework version is a per-project setting, not a per-configuration setting. How did this come about? Are you editing the project file by hand? How exactly is this getting built? What exactly are you looking at to know the target version? Commented Aug 3, 2014 at 12:57
  • I've added the specific configurations by hand but it does not matter! If I configure the project via the properties dialog to target 4.5.1 then the same thing happens. To answer your questions: I'm building with MSBuild from command line or from Visual Studio with same result. As I wrote I'm using dotPeek. Commented Aug 3, 2014 at 16:56

1 Answer 1

2

Can you try passing in this parameter into your build?

/p:TargetFrameworkVersion=v4.5
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.