Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, August 22, 2019 1:14 PM
Hello,
I have a .net standard library which is referencing onto multiple entity framework core packages via NuGet. However when I build it he only copies my own libaries into the output but not the required dependencies which have been added via NuGet.
I did not find an option (copy locally) like you have when you setup a real reference without that NuGet nonsense.
Is there a way to force him to copy references into into local folder? It's just a pain in the a** to search for the libs in C:\User%\NuGet" and copy them manually into the output folder.
Furthermore I would like to ask if there is a way to teach NuGet to put the references into the solution folder instead of "C:\User%\NuGet"?
I normally do not use NuGet but I know that a few years ago he did store everything solution related into the solution folder. I could not find anything in the settings and I did not find a solution in their "documentation".
Best regards
All replies (3)
Thursday, August 22, 2019 2:23 PM âś…Answered | 1 vote
Hello,
There is a open issue on this here
https://github.com/NuGet/Home/issues/4837
Try unloading the project, right click on the project, edit. Add the following
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
Save, reload, build.
Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
NuGet BaseConnectionLibrary for database connections.
Friday, August 23, 2019 6:34 AM
Thank you very much.
Friday, February 21, 2020 11:20 PM
Same context for me: dotnetstandard project referencing EntityFrameworkCore 3.1.2.
I've added the CopyLocalLockFileAssemblies = true but at execution time, it hhrows the error: Microsoft.Data.SqlClient is not supported on this platform
The solution consisting of adding CopyLocalLockFileAssemblies is not sufficient. It does not pickup and copy to the output the correct Microsoft.Data.SqlClient runtime.
I'm trying different syntaxes in the csproj to copy the correct dll but it always endsup with the Microsoft.Data.SqlClient.dll whose size is 317k ( the generic library that throws the unsupported exception).
Here is the csproj:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy $(OutDir)$(ProjectName).deps.json C:\git\Novelty\Worker-Azure\csx\Debug\roles\Worker\approot\(ProjectName).deps.json" />
</Target>
<Target Name="PostPublish" BeforeTargets="Publish">
<Exec Command="copy $(PublishDir)$(ProjectName).deps.json C:\git\Novelty\Worker-Azure\csx\Debug\roles\Worker\approot\(ProjectName).deps.json" />
</Target>
<Target Name="FilterCopyLocalItems" AfterTargets="ResolveLockFileCopyLocalProjectDeps">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filenme)' == 'Microsoft.Data.SqlClient'" />
</ItemGroup>
</Target>
<Target Name="CopyToBin" BeforeTargets="Publish">
<Copy SourceFiles="$(USERPROFILE)\nuget\packages\microsoft.data.sqlclient\1.0.19269.1\runtimes\win\lib\netstandard2.0\Microsoft.Data.SqlClient.dll" DestinationFolder="C:\git\Novelty\Worker-Azure\csx\Debug\roles\Worker\approot" />
</Target>
<Target Name="CopyToBin2" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(USERPROFILE)\nuget\packages\microsoft.data.sqlclient\1.0.19269.1\runtimes\win\lib\netstandard2.0\Microsoft.Data.SqlClient.dll" DestinationFolder="C:\git\Novelty\Worker-Azure\csx\Debug\roles\Worker\approot" />
</Target>
When I build, the correct dll is copied, when I execute it's back to the wrong library as if the deployment of the worker role to the emulator was copying the wrong library.
I think I'm close to the solution but can't find the right trick.
-- Emmanuel Dreux <a href="http://www.cloudiway.com" title="IAM and migration solutions for the Cloud"> http://www.cloudiway.com</a>