Open moh-hassan opened 7 years ago
Hello. Thanks for another workaround.
My personal workaround is to add <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
to a legacy project (ClassicConsoleApp in this case).
Microsoft is aware of this issue and current milestone for its fix is NuGet 4.4: https://github.com/NuGet/Home/issues/4488
I will add this information to the README.md.
Hello outSourcerer,
i add
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
but it has no effect. If it resolves the bug, Can you add a new commit with this modification Thanks
It should be added to the first <PropertyGroup>...</PropertyGroup>
as in 89162e50ddd5f455e167badd6e38b115d3a3e316.
I did, but also no effect. It seems it's no longer supported by vs 2017 RTM or msbuild.
I have just tested this workaround and legacy .NET application was build successfuly with .NET Standard lib and Newtonsoft.Json.dll copied into its bin folder. I have
Microsoft Visual Studio Professional 2017
Version 15.2 (26430.14) Release
VisualStudio.15.Release/15.2.0+26430.14
with
Microsoft (R) Build Engine version 15.1.1012.6693
So, I have to update vs 2017 RTM
Currently
vs 15.0.0 +26228.4 (without update)
with
Microsoft (R) Build Engine version 15.1.1012.6693
Thanks for help and support
Update: It's working after updating to VisualStudio.15.Release/15.2.0+26430.14
I installed today vs 2017 Preview (Version 15.3.0 Preview 3.0) with msbuild (15.3.388.41745) It uses NuGet.Tools version: 4.3.0-preview4-4199 I confirm your finding.
Test result: Working: add RestoreProjectStyle to the legacy project.
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
It copy all Nuget packages and also SDK packages referenced by NetStandard library
Not Working: add PrivateAssets as described in https://github.com/NuGet/Home/issues/4488
<PrivateAssets>All</PrivateAssets>
I hope the bug will be resolved in the next release of nuget
Update: I deleted all obj /bin folder and rebuild the solution for every test case.
Yes, I believe the RestoreProjectStyle
support requires 15.2 or above, and is not supported in 15.0 and 15.1.
@colinbate, I find RestoreProjectStyle
copy both referenced external Nuget Packages and also all SDK package of the Netstandard library to the bin folder, and I think it's supposed to copy only the external Nuget Packages. Is't right?
The multi-targeting workaround only works for classic CSPROJ but not for PCL (Xamarin). This issue will be fixed?
@wwdenis See my first message in this issue for another possible workaround and regaring the expected time of its fix see the link to the corresponding issue in NuGet repository. If both these workarounds do not work for you you have to apply less elegant one like referencing a NuGet package missing in output directory directly.
PackageReference copy both referenced nuget packages and .Net standard SDK packages. If you want to remove the extra copied binaries, you can use a trimming tool. https://github.com/dotnet/standard/blob/master/Microsoft.Packaging.Tools.Trimming/docs/trimming.md , which is a tool to trim unnecessary binaries from the output. Reference: https://github.com/dotnet/standard/issues/415#issuecomment-314288712
In visual studio 2017 RTM, As a workaround, i modified the the NetStandard project as multi-target:
Rebuild the solution and the referenced dll are copied to bin folder of the legacy console project and it's working fine. Have a look to that fork(develop): https://github.com/moh-hassan/nuget-dependencies-of-netstandard-library-bug