building against Framework 2.0

Answered

Hello,

I need to crate a class library that targets .NET Framework v2.0.

I can do this with no issues in Visual Studio 2017, but when I try to create a new project in Rider 2019.1.2 targeting framework 2.0 and build it, the build fails with the error:

"Project 'TestLib2' load failed: Unable to connect to MSBuild process"

The log file shows:

Microsoft (R) Build Engine Version 2.0.50727.8922
[Microsoft .NET Framework, Version 2.0.50727.8941]
Copyright (C) Microsoft Corporation 2005. All rights reserved.
Build started 6/17/2019 10:36:47 AM.
__________________________________________________
Project "C:\Users\Zach\AppData\Local\Temp\Vihazud.csproj" (default targets):
Target ControllerTaskTarget:
C:\Users\Zach\AppData\Local\Temp\Vihazud.csproj(4,3): error MSB4062: The "JetBrains.Platform.MsBuildTask.ControllerTask" task could not be loaded from the assembly C:\Program Files\JetBrains\JetBrains Rider 2019.1.2\lib\ReSharperHost\JetBrains.Platform.MsBuildTask.v4.dll. Could not load file or assembly 'file:///C:\Program Files\JetBrains\JetBrains Rider 2019.1.2\lib\ReSharperHost\JetBrains.Platform.MsBuildTask.v4.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.
Done building target "ControllerTaskTarget" in project "Vihazud.csproj" -- FAILED.
Done building project "Vihazud.csproj" -- FAILED.
Build FAILED.
C:\Users\Zach\AppData\Local\Temp\Vihazud.csproj(4,3): error MSB4062: The "JetBrains.Platform.MsBuildTask.ControllerTask" task could not be loaded from the assembly C:\Program Files\JetBrains\JetBrains Rider 2019.1.2\lib\ReSharperHost\JetBrains.Platform.MsBuildTask.v4.dll. Could not load file or assembly 'file:///C:\Program Files\JetBrains\JetBrains Rider 2019.1.2\lib\ReSharperHost\JetBrains.Platform.MsBuildTask.v4.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.05

I'm new to C#, so I don't know the ins and outs of the building process, but I'm hoping I can use Rider for this as I am much more comfortable with jetbrains IDEs than I am with visual studio.

Thanks,

Zach

4 comments
Comment actions Permalink

Hello Zach!

It seems that there is an incorrect toolset selected in Rider settings.

Please, share a screenshot of "File | Settings | Build, Execution, Deployment | Toolset and Build." 

 

Kind regards,

Sofia

0
Comment actions Permalink

Here you go Sofia, Thanks.

0
Comment actions Permalink

Hi!

Thank you!
The root of the problem is the MSBuild version. We do not support MSBuild up to Net Framework v3.5. 

Please, try setting up newer MSBuild and check if the problem persists.

1
Comment actions Permalink

Thanks Sofia,

I've got it working now by changing MSBuild to version 4.0 and editing the .csproj <TargetFrameworkVersion> value to v2.0 as well as removing <Reference Include="System.Core">

0

Please sign in to leave a comment.