cd NetCoreProjectReferece\console_netcoreapp20_net46
dotnet restore
dotnet publish -f netcoreapp2.0
MSBUILD : error NU1201: Project classlib_netstandard20 is not compatible with net461 (.NETFramework,Version=v4.6.1).
Project classlib_netstandard20 supports: netcoreapp2.0 (.NETCoreApp,Version=v2.0)
[C:\Git\NetCoreProjectReference\console_netcoreapp20_net461\console_netcoreapp20_net461.csproj]
dotnet publish -f net461
C:\Temp\dotnet-sdk-2.0.0-preview2-006391-win-x64\sdk\2.0.0-preview2-006391\Sdks\Microsoft.NET.Sdk\build\
Microsoft.PackageDependencyResolution.targets(164,5): error :
Assets file 'C:\Git\NetCoreProjectReference\classlib_netstandard20\obj\project.assets.json' doesn't have a target
for '.NETStandard,Version=v2.0'. Ensure you have included 'netstandard2.0' in the TargetFrameworks for your project.
[C:\Git\NetCoreProjectReference\classlib_netstandard20\classlib_netstandard20.csproj]
Above publish commands work if the --no-restore parameter is added.
In CLI 2.0.0-preview2-006391 or later,
dotnet publish -f
fails on an app with a project reference to a netstandard2.0 class library.Repro Steps
git clone https://github.com/mikeharder/NetCoreProjectReference
cd NetCoreProjectReferece\console_netcoreapp20_net46
dotnet restore
dotnet publish -f netcoreapp2.0
dotnet publish -f net461
--no-restore
parameter is added.