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.

Framework Assemblies missing from package despite being referenced in project file

See original GitHub issue

While #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:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nguerreracommented, Aug 31, 2017

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.

0reactions
bordingcommented, Aug 4, 2017

Ah, and now that I’ve done that research, it looks like this has the same underlying cause as #1443.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio refuses to build project due to missing ...
c# - Visual Studio refuses to build project due to missing assembly reference that isn't missing - Stack Overflow.
Read more >
Troubleshoot broken references - Visual Studio
Fix a broken project reference · In Solution Explorer, right-click your project node, and then select Properties. The Project Designer appears.
Read more >
MSB3644: The reference assemblies for 'version' were not ...
This error occurs when the .NET reference assemblies aren't found for the version of .NET that a project requests. Check that your project...
Read more >
Missing Assembly References in Test Studio Project
1. Open your test project in Visual Studio. · 2. Go to Solution Explorer. · 3. Expand the project and open the References...
Read more >
Packages restored, but your project is still missing references?
Now, the problem arises if the solution is located in a much different location than the project and you include nuget packages. What...
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