You will need to modify the project files manually (I played with csproj - I hope vbproj works the same way).
All project configuration properties described in sections like this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> ... </PropertyGroup>
Pay attention to the Condition statement, which describes that this particular set of properties is specified for the Debug, AnyCPU configuration Debug, AnyCPU .
What you need to do is move the TargetFrameworkVersion property from the general top level to the configuration levels, something like this:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> </PropertyGroup>
Please note that the VS.Net GUI does NOT support this and does not display the correct values ββin the project properties window; although he will use these values ββfor assembly.
Depending on the complexity of your solution, you may find other artifacts, since VS.Net will not properly reload the project, but at least this should work with the build from the console.
In addition, you may need to use similar conditional βhacksβ to link to the appropriate libraries.
source share