Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Can you target .NET Framework, .NET Standard and .NET Core in a NuGet package?

$
0
0

I'm new to creating NuGet packages and have only been playing around with them for a couple of days, as it now stands I've tested my package on .NET Frameworks 3.5 through 4.8 successfully.

By the way, this is the package: https://www.nuget.org/packages/ExcelFromList/1.0.4

My package relies on EPPlus, which is what I use as the engine. If you search for EPPlus you will see that it states that it can be installed on .NET Framework, .NET Standard, and .NET Core, I have tested this and it's correct.

So I'm not sure how to pull this off.

This is the info on my project:

  • Project is .NET 3.5
  • Using nuget.exe to create the NuGet package
  • Using .nuspec file for package creation (nuget pack <.nuspec file>)
  • Only NuGet package installed in project is EPPLus

This is my .nuspec file:

<?xml version="1.0" encoding="utf-8" ?><package><metadata><requireLicenseAcceptance>false</requireLicenseAcceptance><id>ExcelFromList</id><version>1.0.4</version><title>ExcelFromList</title><description>Straightforward and easy way to create stylized excel workbooks from lists. Add an image, title, subtitles and overal cell styles/formats. Uses the EPPlus engine.</description><releaseNotes>Succesfully tested on .NET frameworks from 3.5 through 4.8</releaseNotes><authors>Raul Marquez</authors><owners>Raul Marquez</owners><copyright>Copyright 2020 Raul Marquez</copyright><projectUrl>https://github.com/RaulMarquezInclan/ExcelFromList</projectUrl><license type="expression">GPL-3.0-only</license><tags>excel list listtoexcel</tags><dependencies><dependency id="EPPlus" version="5.1.0" /></dependencies></metadata><files><file src="bin\Debug\net35\ExcelFromList.dll" target="lib\net35" /><file src="bin\Debug\net35\ExcelFromList.xml" target="lib\net35" /></files></package>

Building the package with that configuration throws me this warning:

WARNING: NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below: - Add a dependency group for .NETFramework3.5 to the nuspec

However, as I stated before, it still installs and runs just fine throughout the different .NET Framework versions.

When attempting to install it on .NET Standard or .NET Core it will install my dll correctly but it won't install EPPlus, which is a dependency of my package. On the .NET Standard side, I only have to manually install it and all is good, on the .NET Core side after doing the same it tells me that the executable cant run in the project.

So, where I'm confused is on how to also make them available to .NET Standard and .NET core, from searching around I've gotten hints about converting it to a .NET standard in the first place, or having three different dlls each corresponding the the different technologies and specifying them in the files section of the .nuspec file, etc.

Can anyone please point me in the right direction?

EDIT: By the way, when looking at the EPPlus package this is what we see:

EPPLus

Thanks.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>