0

I have a .net standard 2.0 class library project with the following setup:

  • At the solution root folder (the .sln file location) I have a nuget package (Which also has other nuget dependencies) a co-worker wrote which I need to use. I configured this location as a package source and added the nuget package through package manager.
  • At the solution root folder (the .sln file location) I also have 'dlls' folder in which i have a dll I added refence to manually (through refence manager)

This is the class library with the dependencies

enter image description here

I try pack at using VS 19 right clicking on the project and 'Pack' option. But only the class library dll is added

So I also tried packing it with .nuspec file to take all files from release folder

<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>  

        ...
        ...
        <!-- Dependencies are automatically installed when the package is installed -->
       <dependencies> 
           <group targetFramework=".NETStandard2.0"></group>
         </dependencies> 
    </metadata>

    
    <files>
        <file src=".\bin\Release\netstandard2.0\*.*" target="lib\netstandard2.0" />
    </files>
</package>

And it does pack all dlls. But There I get an exception when running the application which used the generated nuget package.

System.PlatformNotSupportedException: 'Windows Data Protection API (DPAPI) is not supported on this platform.'

I am testing it using .net core 3.0 console app.

If I use the class library I try to pack by adding it as a project reference to the console app, it all works perfect.

What am I doing wrong?

EDIT:

As @Lasse V. Karlsen requested, I tried unpacking the nuget and add the dlls as references and did noticed some problem.

So, Again this is the class library with the nuget package my co-worker wrote. with the packages refernced by that package extended, Pay attention to System.Security.Cryptography.ProtectedData

enter image description here

When add my nuget package to console app:

enter image description here

But when I try to unpack the package and add the dlls refernces, I get an error on 3 of the dlls System.Security.Cryptography.ProtectedData depends on. Those which marked at the pictures. I get this error when try to add them:

enter image description here

ATT
  • 921
  • 3
  • 13
  • 30
  • On which platform are you running your application? – Lasse V. Karlsen Aug 11 '21 at 11:45
  • Windows 10, Again: If I use the class library I try to pack by adding it as a project reference to the console app, it all works perfect. – ATT Aug 11 '21 at 11:46
  • So just so I understand it. If you add it as a nuget reference, it doesn't work, but if you add it as a direct dll reference, then it works? Can you try unzipping your nuget package and direct referencing the dll inside, just to rule out that the dll's are actually different? – Lasse V. Karlsen Aug 11 '21 at 11:51
  • You understand correct. I did noticed something weird after your suggestion. I edited the question – ATT Aug 11 '21 at 12:22
  • Does this provide any insight? https://stackoverflow.com/questions/48208262/net-standard-2-0-and-system-security-cryptography-protecteddata-protect - I'm just winging it now, I have no idea :) – Lasse V. Karlsen Aug 11 '21 at 12:27
  • Thank for the effort. I also saw that example. But the fact it works when using the class library as a reference in the console app makes me believe is more of an issue of configuration for packing the nuget rather then that exception. I think if i could pack the package with the local nuget package and the dll it will work fine – ATT Aug 11 '21 at 12:30

0 Answers0