facebooktwittermenuarrow-up

GemBox Support Forum

Referenced component could not be found (Non-SDK-style project format)

When adding the NuGet package for GemBox.Pdf (version 15.0.1077) to a .NET Standard 2.0 library, I am getting the following warning when building:

The referenced component ‘C:\Users\icoumans.nuget\packages\gembox.pdf\15.0.1077\buildTransitive\netstandard2.0…\build\netstandard2.0\libpkcs11-mock.a’ could not be found.

To reproduce this, I’ve tried it on a new project, and getting the same warning, with these steps:

  1. Create a new Class Library project for .NET Standard 2.0
  2. Add the GemBox.Pdf package
  3. Build the project

After removing/reinstalling the package, or clearing the NuGet cache, the warning will disappear for one build. For each consecutive build, or when building projects that include the library, the warning will return.

I have found a similar or equal issue from earlier this year, but it seems like it has returned or was not fixed for .NET Standard 2.0: https://forum.gemboxsoftware.com/t/error-msb3341-on-net-5/199

Hi Ivo,

I’m afraid I was unable to reproduce this. I’ve followed your steps and tried “Build” and “Rebuild” numerous times without any issue.

Can you please share with us a project that reproduces this issue?

Regards,
Mario

Hello Mario,

Thank you for your reply. I’m very sorry, but it seems I was mixing up two libraries I was working on. The .NET Standard 2.0 version seems to be working correctly. It’s the .NET Framework 4.6.1 one that produces this warning.

I’ve uploaded a sample project to FileBin: https://filebin.net/fexp7lwlfoy8tdit/TestProject1.rar?t=ugpfev14

When I create the project and build it initially, the warning does not appear. After restarting Visual Studio, the warning will appear on each consecutive rebuild.

Thanks again!

PS: If you could edit the post title or main post to reflect that the warning occurs in .NET Framework and not .NET Standard, that would be helpful.

Hi Ivo,

It seems that the issue is happening if the .csproj file is in Non-SDK-style format.

.NET Framework projects support PackageReference and this might be a Visual Studio issue.

The workaround is to include the PackageReference like this:

<PackageReference Include="GemBox.Pdf" Version="15.0.1077" ExcludeAssets="build;buildMultitargeting;buildTransitive" />

To do this, unload the project, edit the project file, and reload the project.

This way problematic assets won’t be consumed since they are not required for .NET Framework anyway.

Regards,
Stipo

Thank you! This works perfectly.