Skip to content

CopyLocal for satellite assemblies broken: copies all of them to the same bin directory #1132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rainersigwald opened this issue Apr 19, 2017 · 1 comment

Comments

@rainersigwald
Copy link
Member

From @AArnott on April 19, 2017 16:13

When copied locally to an app, satellite assemblies should always be copied to their respective subdirectories according to their culture.

When a project defines TargetFrameworks, this behavior regresses. It works fine when TargetFramework is defined directly in a project instead.

Repro steps

dotnet new classlib
dotnet add package microsoft.visualstudio.validation -v 15.0.82

Modify project file as follows:

 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>netstandard1.4</TargetFramework>
+    <TargetFrameworks>net46</TargetFrameworks>
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="microsoft.visualstudio.validation" Version="15.0.82" />

Then restore and build:

dotnet restore
dotnet build

Expected

Satellite assemblies for the PackageReference to be copied to their appropriate subdirectories like this:

C:\TEMP\LOC2\BIN
└───Debug
    └───net46
        │   loc2.dll
        │   loc2.pdb
        │   Microsoft.VisualStudio.Validation.dll
        │
        ├───es
        │       Microsoft.VisualStudio.Validation.resources.dll
        │
        └───jp
                Microsoft.VisualStudio.Validation.resources.dll

Actual

The satellite assemblies are all copied to the root bin folder:

C:\TEMP\LOC2\BIN
└───Debug
    └───net46
            loc2.dll
            loc2.pdb
            Microsoft.VisualStudio.Validation.dll
            Microsoft.VisualStudio.Validation.resources.dll

This is a problem for several reasons:

  1. the app, and tests, will misbehave as they won't find the satellite resource assemblies at runtime.
  2. during the build, all the satellite assemblies are copied, such that the build log reveals we have multiple file writes to the same location. I presume the result is non-deterministic.

Note that dotnet publish -f net46 lays the files out in their correct locations. But this is not an acceptable workaround for local building and testing. This is a regression as NuGet references previous to VS2017 (15.1) would copy them to the right locations and I depend on that.

Copied from original issue: dotnet/msbuild#1994

@nguerrera
Copy link
Contributor

Closing as duplicate of #1006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants