question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building and running project for net462 runtime

See original GitHub issue

Issue might be related to https://github.com/dotnet/sdk/issues/1488 There are several reproductions of the issue. The test package for the issue is cloudscribe.Web.Pagination https://www.nuget.org/packages/cloudscribe.Web.Pagination/1.1.4, which is targeting netstandard1.6 only; startup project A target is net462 as well as referenced project B.

The issue might be due to screwed up package, wrong target (why if so?) but it’s not clear by error messages or behavior.

https://github.com/multiarc/SDKRepro/branches

global.json used to specify SDK version 1.1.8

build_fail – not able to build. Error messages is not clear what to do, all packages including framework assemblies appeared with warning mark.

  • MSB4062 The "NETBuildExtensionsError" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\\tools\net46\Microsoft.NET.Build.Extensions.Tasks.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. A C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.NETFramework.targets 65
  • Cannot find project info for 'C:\Docs\Work\SDKRepro\src\B\B.csproj'. This can indicate a missing project reference. A C:\Program Files\dotnet\sdk\1.1.8\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets 92

run_fail – able to build using <DependsOnNETStandard>netstandard1.6</DependsOnNETStandard>, cannot start (System.Linq 4.1.0.0 assembly cannot load)

master – completely fine project, builds and starts up no problem, just an example without package reference

global.json is removed

no_global_run_fail – same as run_fail

no_global_another_run_fail – magically able to build, cannot start due to Microsoft.CSharp assembly cannot load

SDK Versions

.NET Command Line Tools (2.1.101)

Product Information:
 Version:            2.1.101
 Commit SHA-1 hash:  6c22303bf0

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.101\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.6
  Build    : 74b1c703813c8910df5b96f304b0f2b78cdf194d
.NET Command Line Tools (1.1.8)

Product Information:
 Version:            1.1.8
 Commit SHA-1 hash:  227be613d2

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.1.8

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.6
  Build    : 74b1c703813c8910df5b96f304b0f2b78cdf194d

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dsplaistedcommented, Mar 16, 2018

OK, I’ve worked out what’s going on. Thanks a lot for the repro

build_fail branch

It’s not supported to build this project with a 1.x SDK. You are supposed to get the following error message:

The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK.

However, this is broken in VS 15.6, and you get the error that the NETBuildExtensionsError task can’t be loaded instead. I’ve filed #2061 for this.

run_fail and no_global_run_fail branches

Setting the DependsOnNETStandard property to netstandard1.6 is not supported. It (incidentally) has the same effect as setting this property to false, which disables build logic that is needed to make the project run correctly.

no_global_another_run_fail branch

Now the only remaining is the original one that was reported in #1488. The workaround is to add a reference to a 2.0 version of the Microsoft.Extensions.DependencyModel package:

<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />

You could also update the app to use ASP.NET Core 2.0, though that would likely require more changes.

0reactions
livarcocccommented, Sep 20, 2018

Closing as @dsplaisted seems to have addressed all the issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >
How to get the Target Framework version used to build a ...
In my experimenting, I'd like to find out from code, at runtime, which target framework was used to build the project.
Read more >
Building .NET Framework ASP.NET Core apps on Linux ...
In this post I describe the steps to get an ASP.NET Core library that targets both .NET Framework and .NET Standard, building, and...
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
A 15-second guide and 15-minute walk through. You have a .Net Core project, whether a netstandard library, or a netcore app, and you'd...
Read more >
Dotnet build linux. The answer you're looking for is basically
But when I build the project that references DAL, the value for RuntimeIdentifier disappears: Command: dotnet build Transformer\Transformer. dotnet new ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found