Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building and running project for net462 runtime #2045

Closed
multiarc opened this issue Mar 14, 2018 · 5 comments
Closed

Building and running project for net462 runtime #2045

multiarc opened this issue Mar 14, 2018 · 5 comments
Milestone

Comments

@multiarc
Copy link

multiarc commented Mar 14, 2018

Issue might be related to #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
@livarcocc livarcocc added this to the Discussion milestone Mar 14, 2018
@livarcocc
Copy link
Contributor

@dsplaisted @joperezr to comment. I wonder if this is related to conflict resolution.

@dsplaisted
Copy link
Member

dsplaisted commented Mar 16, 2018

@multiarc I think the issue in the build_fail branch is that you haven't run dotnet restore. In 1.x versions of the .NET Core SDK, you had to explicitly run dotnet restore. In 2.0 and higher, this happens automatically.

EDIT: Nevermind, that was an error I ran into, but it looks like you hit a different issue.

@multiarc
Copy link
Author

@dsplaisted sure I did.
Cannot find project info error is happening in a lot of other situations though.

@dsplaisted
Copy link
Member

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.

@livarcocc
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants