fahadash
fahadash

Reputation: 3281

Could not add nuget package to class library

I am using Visual Studio 2017, I created an empty .NET Core Class Library, I tried to add a package to my project and got the following error

Invalid portable frameworks for '.NETPortable,Version=v0.0'. A portable framework must have at least one framework in the profile

I searched internet for help, could not find anything. This class library is referenced in a ASP.NET MVC Core app which does not have a project.json file, I guess it is gone now. Any help is appreciated.

Upvotes: 2

Views: 2564

Answers (1)

Andrii Litvinov
Andrii Litvinov

Reputation: 13182

I suppose you have created a nuget package that you want to use in your projects. Mentioned nuget package is created as Portable Class Library and can be installed in regular Class Library projects.

If you want to be able to install this package to .NET Core class libraries or console apps (which includes web applications) you need to create it as .NET Standard Class Library. There is a walk through on how to do it: Create .NET standard packages with Visual Studio 2017.

UPDATE:

From what I have found C++ is not supported in .NET Core and there is no plans to support it right now Proposal: C++/CX support, Will CoreCLR support C++/CLI crossplat?, Using .Net (C++/CLI) legacy code in Net Core.

I am not an expert in C++, but maybe it is possible to create a library in C++ and P/Invoke it with C# and wrap both in NuGet package? Or rewrite it completely in C#?

Upvotes: 1

Related Questions