Framework Assemblies missing from package despite being referenced in project file
See original GitHub issueWhile #1379 fixed the problem of framework assemblies of dependencies being incorrectly hoisted into the parent nuspec, it appears the there is still a problem in this area.
The problem scenario
I have a package that includes source files via the contentFiles mechanism, and it also has framework assembly references to ensure the included source compiles:
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Configuration" targetFramework=".NETFramework4.5.2" />
<frameworkAssembly assemblyName="System.Security" targetFramework=".NETFramework4.5.2" />
</frameworkAssemblies>
I’ve added a PackageReference to this package in my project:
<PackageReference Include="Particular.Licensing.Sources" Version="1.0.0-alpha0002" PrivateAssets="All" />
It’s been marked PrivateAssets=“All” because it includes source files that I compile into the project, so I don’t want it to be a dependency of my project’s package.
However, to ensure that all of the framework assembly references are included as part of my project’s package, I’ve explicitly added references as well, along with a third reference required by the project:
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
<Reference Include="System.Configuration" />
<Reference Include="System.Security" />
<Reference Include="System.Transactions" />
</ItemGroup>
When I pack this project, I only get a frameworkAssembly entry for System.Transactions. The other two are now missing after upgrading to the latest SDK daily:
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Transactions" targetFramework=".NETFramework4.5.2" />
</frameworkAssemblies>
Expected Behavior
I expect to see all of the added references in my project show up as framework references regardless of what packages I have installed, especially if the conflicting package is marked PrivateAssets=“All”.
Actual Behavior
The references are missing if a dependency has them listed as frameworkAssemblies regardless of the PrivateAssets value.
Tested with SDK 2.0.0-preview3-006912
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Tracking the work to fix this in #1443 which indeed has the same root cause. I made a note to capture both issues in tests when fixing.
Ah, and now that I’ve done that research, it looks like this has the same underlying cause as #1443.