Combine all *.dll into a folder instead of main directory of program

dv2020

Active member
Joined
Dec 18, 2020
Messages
30
Programming Experience
1-3
Hello,

I'm trying to work out how to get my application to store all the *.dll files that were installed using NuGet into a folder "lib" inside the application root directory automatically when I complete a build?

If anyone has any ideas, that would be great.

Thanks

David
 
Solution
I found two bits of information at stackoverflow that worked for me when testing:
add to project file in Project node:
<Target Name="CopyPackageAssembliesToSubFolder" AfterTargets="ResolveReferences">
    <ItemGroup>
      <ReferenceCopyLocalPaths Condition=" '%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' "
        Update="%(ReferenceCopyLocalPaths)"
        DestinationSubDirectory="lib\" />
    </ItemGroup>
</Target>
add to app.config in configuration node:
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="lib" />
    </assemblyBinding>
</runtime>
from:
...
I found two bits of information at stackoverflow that worked for me when testing:
add to project file in Project node:
<Target Name="CopyPackageAssembliesToSubFolder" AfterTargets="ResolveReferences">
    <ItemGroup>
      <ReferenceCopyLocalPaths Condition=" '%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' "
        Update="%(ReferenceCopyLocalPaths)"
        DestinationSubDirectory="lib\" />
    </ItemGroup>
</Target>
add to app.config in configuration node:
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="lib" />
    </assemblyBinding>
</runtime>
from:
 
Solution
Back
Top Bottom