question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Satellite assemblies from PackageReference all copy to root bin folder

See original GitHub issue

From @AArnott on June 20, 2017 15:19

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): 4.3.0

VS version (if appropriate): 15.3.26616.2.d15rel

OS version (i.e. win10 v1607 (14393.321)): Win10 15063.rs2_release.170317-1834

Worked before? If so, with which NuGet version: Yes, this worked in 15.1 or 15.2 I believe.

Detailed repro steps so we can see the same problem

Create a new .NET Core library, then replace the project file content with this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.VisualStudio.Composition" Version="15.0.71" />
  </ItemGroup>
</Project>

Restore, and build.

Expected

The project’s bin folder has just a few DLLs, and a bunch of culture folders, each with a few *.resources.dll assemblies.

Actual

The bin folder that contains the project output no sub-folders. Instead, “all” the satellite assemblies are copied into that one root bin folder, causing each one to overwrite another so that only one culture wins. And at runtime, the satellite assemblies cannot be found.

Copied from original issue: NuGet/Home#5458

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:30 (30 by maintainers)

github_iconTop GitHub Comments

3reactions
nguerreracommented, Jun 21, 2017

Here is a workaround when using v2.0 is not possible:

  <!-- Work around bug in Microsoft.NET.Sdk < v2.0 where satellites were deployed on top of each other in root. -->
  <!-- https://github.com/dotnet/sdk/issues/1360 -->
  <Target Name="WorkaroundIncorrectSatelliteDeployment" AfterTargets="ResolveLockFileCopyLocalProjectDeps">
    <ItemGroup>
      <ReferenceCopyLocalPaths Remove="@(ResourceCopyLocalItems)" />
      <ReferenceCopyLocalPaths Include="@(ResourceCopyLocalItems)" Condition="'@(ResourceCopyLocalItems)' != ''">
        <DestinationSubDirectory>$([System.IO.Directory]::GetParent(%(ResourceCopyLocalItems.FullPath)).get_Name())\</DestinationSubDirectory>
      </ReferenceCopyLocalPaths>
    </ItemGroup>
  </Target>
2reactions
jaredparcommented, Jun 21, 2017

@nguerrera verified this works. Our build correctness leg is no longer flagging double writes and I manually verified the output directory contains the proper resource layout. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to copy Satellite assembly to different folder after build?
The problem is after the project is built, I have to copy the contents of bin/debug folder into a different directory. To copy...
Read more >
How to copy dependent assemblies to the bin folder on build?
This will copy all of the NuGet dependencies to your output directory! The documentation says this: If you set this property to true,...
Read more >
MSBuild reference for .NET SDK projects
The CopyLocalLockFileAssemblies property is useful for plugin projects that have dependencies on other libraries. If you set this property to ...
Read more >
Create a package using the nuget.exe CLI
A detailed guide on designing and creating a NuGet package, including files and versioning.
Read more >
How to use a folder different from the Bin folder to store ...
Hello, I was looking how to add multi languages to devexpress and I found out I had to add DLL's inside my Bin...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found