3

I'm trying to multi-target a project between two .net versions. I've edited the .vbproj file like so

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'GP2010|AnyCPU'">
 <ReferencePath>\\server\references\newcrystal</ReferencePath>3
 <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
 <OutputPath>bin\GP2010\</OutputPath>
 <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'GP2015|AnyCPU'">
 <ReferencePath>\\server\references\gp2015</ReferencePath>
 <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
 <OutputPath>bin\GP2015\</OutputPath>
 <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>

I can compile the .net 2.0 version just fine. When I try and compile the .net 4.5.1 version, I get the following error:

The 'System.Runtime.Versioning.TargetFrameworkAttribute' is not defined
.NETFramework,Version=v4.5.1,AssemblyAttributes.vb

I open that file in %temp%, and don't notice anything wrong.

Option Strict Off
Option Explicit On

Imports System
Imports System.Reflection
        <Assembly: Global.System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.1", FrameworkDisplayName:="")>

However, I do try and add

 Imports System.Runtime.Versioning

to try and get the runtime to pick it up, but it makes no difference.

I also tried adding GenerateTargetFrameworkMonikerAttribute from this question, but it didn't seem to help, but I may have had it in the wrong place.

In Visual Studio 2010 why is the .NETFramework,Version=v4.0.AssemblyAttributes.cpp file created, and can I disable this?

Community
  • 1
  • 1
svallarian
  • 31
  • 4

0 Answers0