Closed Jepson109 closed 4 years ago
@dsplaisted can you take a look?
It looks like this is because we don't have a version of NuGet in this repo that honors PrivateAssets="All"
on FrameworkReference
items.
@nkolev92, Is the attribute correct here? Which insertion of NuGet would include the code to understand that?
Yep, that looks right.
https://github.com/dotnet/sdk/pull/3243 should be the first insertion carrying those bits.
Not repro on CLI/SDK 3.0.100-preview6-012027
Looks like this has been fixed.
Currently this happens in Visual Studio 2019 Preview but not on command line.
@dsplaisted I'm also having this issue when building from VS 2019 16.2 Preview 1 and daily .NET Core build.
Good point, this failure will still show up in VS until VS has the NuGet change (which should be in 16.2 Preview 2 I believe).
I'm hitting this error in both VS and the latest CLI (3.0.100-preview7-012287). Is there a known workaround?
@PinpointTownes Do you get an error if you close VS, delete your "bin" and "obj" folders, and then run dotnet build
from the command line?
It works fine on command line. It's just a Visual Studio issue atm for me.
@dsplaisted thanks for your reply. It indeed works when do you that (it's the trick I actually used to temporarily unblock me), but as soon as I reopen VS and try to run the app, the error immediately reappears 😄
I guess I'll just have to wait for the next preview to ship. But in the meantime, the experience will be really terrible. I suppose there's no trivial way to work around that in VS, right?
As a workaround, you can put the following in your .NET Core project which references .NET Standard 2.1:
<Target Name="WorkaroundNetStandard" AfterTargets="ResolvePackageAssets">
<ItemGroup>
<TransitiveFrameworkReference Remove="NETStandard.Library" />
</ItemGroup>
</Target>
Brilliant, it works like a charm. Thanks! 👏
Is there an issue to track fixing the new bug?
Is it safe to start publishing NuGet packages with netstandard2.1 targets?
This should be working on the latest version of VS. Installing it now to try it out and will report back.
This is working using the latest VS build and the latest preview6 CLI.
This is working using the latest VS build and the latest preview6 CLI.
@livarcocc - Specifically which versions? I still get this error with the following versions:
NetCoreApp3.0: preview6-27804-01 Visual Studio: 16.1.3
This is working using the latest VS build and the latest preview6 CLI.
@livarcocc - Specifically which versions? I still get this error with the following versions:
NetCoreApp3.0: preview6-27804-01 Visual Studio: 16.1.3
You have to use the latest Visual Studio preview.
Adding this also solves this error in projects that fail to build:
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
@dsplaisted and @livarcocc, something seems to have regressed related to this bug in the VS 16.x versions on our BYOC agents. At least the problem feels similar though the dependency relationship is reversed.
For example, we've got a dependency update PR (aspnet/Extensions#2082) that hits the following error in a .NET Standard 2.1 project that references a project targeting both .NET Standard 2.0 and .NET Core 3.0:
D:\a\1\s\.dotnet\sdk\3.0.100-preview6-012264\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.TargetingPackResolution.targets(192,7): error MSB4028: The "ResolveTargetingPackAssets" task's outputs could not be retrieved from the "PackageConflictOverrides" parameter. Parameter "includeEscaped" cannot have zero length. [D:\a\1\s\src\Hosting\Systemd\src\Microsoft.Extensions.Hosting.Systemd.csproj]
Should I try either or both of the workarounds for this bug?
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<Target ...><ItemGroup><TransitiveFrameworkReference Remove="NETStandard.Library" /></ItemGroup></Target>
Is this new issue tracked somewhere else?
Separately, we have workaround 2. in our AspNetCore repo. Should I attempt to remove that or expect the new issue to show up?
/cc @aspnet/build
The new issue will be fixed with this: https://github.com/dotnet/sdk/pull/3463
I'm still seeing this issue when building with Azure DevOps using the MSBuild Task, even on the 3.0.100 release of .net core sdk.
@davidmilligan Probably Azure DevOps hasn't been updated to Visual Studio 16.3 if you're getting this error.
But that’s the thing. It has been updated to 16.3.
Same issue as @davidmilligan here. It works for the devs locally but not on Azure DevOps MSBuild Task. We also have the latest VS version installed
I am getting this issue using Rider on MacOS with 3.0.100 SDK when trying to reference a netstandard2.1 library in a netcoreapp3.0 project. I have removed all preview SDKs and Runtimes.
Project is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Project supports: netstandard2.1 (.NETStandard,Version=v2.1)
Target framework mismatching: can't reference project MyProject.Logging (.NETStandard,Version=v2.1) from MyProject.MicroServiceHost (.NETCoreApp,Version=v3.0)
dotnet build
works fine from the command line but when Rider uses MSBuild 3.0.100 to do the build I get these errors.
This error seems like it might be indicative of something:
Benchmarks/Benchmarks.csproj" (default target) (46) ->
/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0.
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100/
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.2.103 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I am not sure how Ryder works, but given that it works from the command line, I suspect they might be copying tasks/targets and they may be stale.
I would file an issue against Ryder for this.
It does not work from the command line. dotnet build
works. I cannot run msbuild
directly, it has the same errors. I also cannot run dotnet msbuild
, it also has the same errors. When I run msbuild
, I believe it is doing
exec /Library/Frameworks/Mono.framework/Versions/6.4.0/bin/mono $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/MSBuild.dll
I'm not sure what dotnet msbuild
runs.
EDIT: I also tried to use the MSBuild from the dotnet core sdk but I got a bunch of exceptions
exec /Library/Frameworks/Mono.framework/Versions/6.4.0/bin/mono $MONO_OPTIONS /usr/local/share/dotnet/sdk/3.0.100/MSBuild.dll
$msbuild
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.BadImageFormatException: Could not resolve field token 0x0400036b, due to: Could not load type of field 'Microsoft.Build.Execution.BuildManager:_workQueue' (33) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Build.dll type:BuildManager member:(null)
File name: 'Microsoft.Build'
at Microsoft.Build.CommandLine.MSBuildApp.BuildProject (System.String projectFile, System.String[] targets, System.String toolsVersion, System.Collections.Generic.Dictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.Dictionary`2[TKey,TValue] restoreProperties, Microsoft.Build.Framework.ILogger[] loggers, Microsoft.Build.Framework.LoggerVerbosity verbosity, Microsoft.Build.CommandLine.DistributedLoggerRecord[] distributedLoggerRecords, System.Int32 cpuCount, System.Boolean enableNodeReuse, System.IO.TextWriter preprocessWriter, System.Boolean detailedSummary, System.Collections.Generic.ISet`1[T] warningsAsErrors, System.Collections.Generic.ISet`1[T] warningsAsMessages, System.Boolean enableRestore, Microsoft.Build.Logging.ProfilerLogger profilerLogger, System.Boolean enableProfiler, System.Boolean interactive, System.Boolean isolateProjects, System.Boolean graphBuild, System.String[] inputResultsCaches, System.String outputResultsCache) [0x005a0] in <faa2ef9cf63940199fa55bdf037faaa3>:0
at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String[] commandLine) [0x001a5] in <faa2ef9cf63940199fa55bdf037faaa3>:0
Unhandled Exception:
System.BadImageFormatException: Could not resolve field token 0x0400036b, due to: Could not load type of field 'Microsoft.Build.Execution.BuildManager:_workQueue' (33) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Build.dll type:BuildManager member:(null)
File name: 'Microsoft.Build'
at Microsoft.Build.CommandLine.MSBuildApp.BuildProject (System.String projectFile, System.String[] targets, System.String toolsVersion, System.Collections.Generic.Dictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.Dictionary`2[TKey,TValue] restoreProperties, Microsoft.Build.Framework.ILogger[] loggers, Microsoft.Build.Framework.LoggerVerbosity verbosity, Microsoft.Build.CommandLine.DistributedLoggerRecord[] distributedLoggerRecords, System.Int32 cpuCount, System.Boolean enableNodeReuse, System.IO.TextWriter preprocessWriter, System.Boolean detailedSummary, System.Collections.Generic.ISet`1[T] warningsAsErrors, System.Collections.Generic.ISet`1[T] warningsAsMessages, System.Boolean enableRestore, Microsoft.Build.Logging.ProfilerLogger profilerLogger, System.Boolean enableProfiler, System.Boolean interactive, System.Boolean isolateProjects, System.Boolean graphBuild, System.String[] inputResultsCaches, System.String outputResultsCache) [0x005a0] in <faa2ef9cf63940199fa55bdf037faaa3>:0
at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String[] commandLine) [0x00415] in <faa2ef9cf63940199fa55bdf037faaa3>:0
at Microsoft.Build.CommandLine.MSBuildApp.Main (System.String[] args) [0x00029] in <faa2ef9cf63940199fa55bdf037faaa3>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.BadImageFormatException: Could not resolve field token 0x0400036b, due to: Could not load type of field 'Microsoft.Build.Execution.BuildManager:_workQueue' (33) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Build.dll type:BuildManager member:(null)
File name: 'Microsoft.Build'
at Microsoft.Build.CommandLine.MSBuildApp.BuildProject (System.String projectFile, System.String[] targets, System.String toolsVersion, System.Collections.Generic.Dictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.Dictionary`2[TKey,TValue] restoreProperties, Microsoft.Build.Framework.ILogger[] loggers, Microsoft.Build.Framework.LoggerVerbosity verbosity, Microsoft.Build.CommandLine.DistributedLoggerRecord[] distributedLoggerRecords, System.Int32 cpuCount, System.Boolean enableNodeReuse, System.IO.TextWriter preprocessWriter, System.Boolean detailedSummary, System.Collections.Generic.ISet`1[T] warningsAsErrors, System.Collections.Generic.ISet`1[T] warningsAsMessages, System.Boolean enableRestore, Microsoft.Build.Logging.ProfilerLogger profilerLogger, System.Boolean enableProfiler, System.Boolean interactive, System.Boolean isolateProjects, System.Boolean graphBuild, System.String[] inputResultsCaches, System.String outputResultsCache) [0x005a0] in <faa2ef9cf63940199fa55bdf037faaa3>:0
at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String[] commandLine) [0x00415] in <faa2ef9cf63940199fa55bdf037faaa3>:0
at Microsoft.Build.CommandLine.MSBuildApp.Main (System.String[] args) [0x00029] in <faa2ef9cf63940199fa55bdf037faaa3>:0
@robborden Can you open a new issue for the failures you're encountering? The error message is the same but I don't believe the root cause is the same as this issue which has been fixed. Thanks!
Will do, thank you.
@robborden Can you open a new issue for the failures you're encountering? The error message is the same but I don't believe the root cause is the same as this issue which has been fixed. Thanks!
@dsplaisted you say it should be fix now? I still can't build my solution using Visual Studio Build task in TFS. The VS version installed on the build machine is : 16.3.29324.140 I have the following error :
The CSproj of this project contains : "PropertyGroup <TargetFramework>netstandard2.1</TargetFramework> /PropertyGroup"
The main project.csproj contains : "PropertyGroup <TargetFramework>netcoreapp3.0</TargetFramework> <OutputPath>....\bin\$(Configuration)\</OutputPath> /PropertyGroup"
@nimor109 Yes, if you are still getting NETSDK1073, please open a new issue. If you can provide a binary log of the failing build in the issue that will be very helpful.
Steps to reproduce
Note
Expected behavior
The project can be built successfully
Actual behavior
Build with error NETSDK1073: The FrameworkReference 'NETStandard.Library' was not recognized
Environment data
dotnet --info
output: .NET Core SDK (reflecting any global.json): Version: 3.0.100-preview6-012012 Commit: 94b54a5ef6Runtime Environment:
OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview6-012012\
Host (useful for support): Version: 3.0.0-preview6-27718-08 Commit: 7c7a2e9074
.NET Core SDKs installed: 2.1.800-preview-009677 [C:\Program Files\dotnet\sdk] 2.2.400-preview-010195 [C:\Program Files\dotnet\sdk] 3.0.100-preview6-012012 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview6-19265-03 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview6-27718-08 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0-preview6-27718-08 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download