You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.NET SDK projects don't pack satellite assemblies from SatelliteDllsProjectOutputGroup #4698
The SatelliteDllsProjectOutputGroup target produces and returns @(SatelliteDllsProjectOutputGroupOutput) items, which should be included in the nupkg file. For instance, when I build a netstandard library, our LSBuild (.lcl file based) build authoring produces the *.resources.dll satellite assemblies and adds them to this item list. But when packing, these satellite assemblies are not picked up. This is good enough for the rest of msbuild, which properly copies these satellite assemblies across P2P references.
I also notice that even the built-in support for Strings.resx and Strings.es.resx, where I am getting resource assemblies produced by the standard VS toolchain, nuget pack still omits those satellite assemblies.
If there is a workaround I can apply, I'd be happy to for now. How do the packaging targets determine what to pack from the individual TargetFramework builds? I hope I can copy the satellite assembly items to whatever item list is required so that they get included there.
Suggested workaround would be to write a target which would copy the items of @(SatelliteDllsProjectOutputGroupOutput) to BuiltProjectGroupOutput and make sure the FinalOutputPath metadata is set on them.
Thanks for the workaround. I can apply that.
FWIW though, that's conflating two output groups where they are designed to be distinct. NuGet should call into both to get all the files out. I'm not even sure the workaround will work -- because conflating the two could cause malfunctions in msbuild or project systems, including P2P references. Referencing projects expect only one DLL in the BuiltProjectGroupOutput so if I throw in all the satellite assemblies that could break P2Ps.
It looks like your .targets invoke two targets at the moment (Built and Documentation). So we're talking about adding a third to it. Too bad that targets list isn't a property or item list that I can simply add to.
OK, so that third target doesn't set FinalOutputPath on the items. I created my own that does, so now what we have is my satellite assemblies are copied to the root of the nupkg's lib folder (so only one survives since they all have the same name). Instead, they should all be in subfolders of the various lib\TFM folders based on their culture name.
There appears to be no way to solve this in a workaround, since the Pack task strips away all metadata from these items and only keeps the FinalOutputPath, so evidently the logic to place the DLLs in the right places doesn't allow additional input to help it along.
Satellite assemblies must be found in culture\some.resources.dll paths under where the original assembly is found. CLR rules. So yes, they must be found under the TFM.
@AArnott currently Pack figures out the TFM to put a DLL using the path of the DLL on disk. If the path doesn't contain a TFM, then it puts it in the root.
This will also change in future and I will supplement it by providing TargetFramework metadata to the _TargetPathsToAssemblies item.
OK, well it won't be, by design of CLR requirements. So it looks like your enhancement to the Task is required.
In the meantime, my workaround seems to work so I might use that if this bug ends up being the last adoption blocker.
There's another (potential) problem here in your nuget .targets. You are invoking MSBuild in your own project, but because you pass in more than just TargetFramework as a global property (you add BuildProjectReferences=false), this causes over-build. Right now, you appear to be getting away with it, evidently because the targets you're invoking don't have expensive side effects. But the SatelliteDllsProjectOutputGroup target will end up building most of the project, again, because MSBuild sees your unique set of global properties so it thinks it's building a new project.
I also confirm that @AArnott 's workaround works. All it takes is <PackageReference Include="NuGet4698Workaround" Version="1.0.1" PrivateAssets="All" />.
Activity
AArnott commentedon Feb 27, 2017
If there is a workaround I can apply, I'd be happy to for now. How do the packaging targets determine what to pack from the individual TargetFramework builds? I hope I can copy the satellite assembly items to whatever item list is required so that they get included there.
rohit21agrawal commentedon Feb 27, 2017
@AArnott
(BuiltProjectOutputGroup)->FinalOutputPathis what is used to determine what DLLs to be picked up for each TFM.https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks.Pack.Library/Pack.targets#L119
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks.Pack.Library/Pack.targets#L165-L175
Suggested workaround would be to write a target which would copy the items of
@(SatelliteDllsProjectOutputGroupOutput)toBuiltProjectGroupOutputand make sure the FinalOutputPath metadata is set on them.AArnott commentedon Feb 27, 2017
Thanks for the workaround. I can apply that.
FWIW though, that's conflating two output groups where they are designed to be distinct. NuGet should call into both to get all the files out. I'm not even sure the workaround will work -- because conflating the two could cause malfunctions in msbuild or project systems, including P2P references. Referencing projects expect only one DLL in the BuiltProjectGroupOutput so if I throw in all the satellite assemblies that could break P2Ps.
It looks like your .targets invoke two targets at the moment (Built and Documentation). So we're talking about adding a third to it. Too bad that targets list isn't a property or item list that I can simply add to.
AArnott commentedon Feb 27, 2017
OK, so that third target doesn't set FinalOutputPath on the items. I created my own that does, so now what we have is my satellite assemblies are copied to the root of the nupkg's lib folder (so only one survives since they all have the same name). Instead, they should all be in subfolders of the various lib\TFM folders based on their culture name.
There appears to be no way to solve this in a workaround, since the Pack task strips away all metadata from these items and only keeps the FinalOutputPath, so evidently the logic to place the DLLs in the right places doesn't allow additional input to help it along.
Any other ideas?
AArnott commentedon Feb 27, 2017
I've contrived a workaround. I added this to my project file:
EDIT: I edited later to fix some over-build bugs I had in the original version.
rohit21agrawal commentedon Feb 27, 2017
@AArnott instead of adding it to Content and providing a PackagePath, did you try adding them to
_TargetPathsToAssemblieswith theFinalOutputPathmetadata set ?https://github.com/NuGet/NuGet.Client/blob/02df800a3b5422f8e8e828d66417de8927757b85/src/NuGet.Core/NuGet.Build.Tasks.Pack.Library/Pack.targets#L119
On the disk, are satellite assemblies placed in TFM specific folders?
rohit21agrawal commentedon Feb 27, 2017
This is an area i have already planned to add an extension point to, and will do that whenever we fix this bug.
AArnott commentedon Feb 27, 2017
@rohit21agrawal: Yes, I tried adding it to
_TargetPathsToAssembliesbut that didn't work as I describe in my earlier comment.Satellite assemblies must be found in culture\some.resources.dll paths under where the original assembly is found. CLR rules. So yes, they must be found under the TFM.
rohit21agrawal commentedon Feb 27, 2017
@AArnott currently Pack figures out the TFM to put a DLL using the path of the DLL on disk. If the path doesn't contain a TFM, then it puts it in the root.
This will also change in future and I will supplement it by providing
TargetFrameworkmetadata to the_TargetPathsToAssembliesitem.AArnott commentedon Feb 27, 2017
I see. How do you find which segment of a path is the TFM? It's there, but evidently the task wasn't finding it:
rohit21agrawal commentedon Feb 27, 2017
it has to be directly under the TFM folder.
AArnott commentedon Feb 28, 2017
OK, well it won't be, by design of CLR requirements. So it looks like your enhancement to the Task is required.
In the meantime, my workaround seems to work so I might use that if this bug ends up being the last adoption blocker.
AArnott commentedon Feb 28, 2017
There's another (potential) problem here in your nuget .targets. You are invoking MSBuild in your own project, but because you pass in more than just TargetFramework as a global property (you add BuildProjectReferences=false), this causes over-build. Right now, you appear to be getting away with it, evidently because the targets you're invoking don't have expensive side effects. But the
SatelliteDllsProjectOutputGrouptarget will end up building most of the project, again, because MSBuild sees your unique set of global properties so it thinks it's building a new project.AArnott commentedon Feb 28, 2017
I've pushed my workaround as a nuget package: https://www.nuget.org/packages/NuGet4698Workaround
Incorporate @AarnoT's fixes for NuGet/Home#4698
borgdylan commentedon Mar 11, 2017
I have noticed the same thing, all satellite made by resgen and al are omitted even if I can see them in bin/Debug/TFM
borgdylan commentedon Mar 11, 2017
I also confirm that @AArnott 's workaround works. All it takes is
<PackageReference Include="NuGet4698Workaround" Version="1.0.1" PrivateAssets="All" />.