0

I want to create a nuget package of my .net core class library.

  1. I copied the nuget.exe file to the root folder of my Solution
  2. Run nuget spec and Solution.nuspec file created. I modified it as below:

    <?xml version="1.0"?>
    <package >
    <metadata>
    <id>Solution</id>
    <version>1.0.0</version>
    <authors>cc Team</authors>
    <owners>cc</owners>
    <licenseUrl></licenseUrl>
    <projectUrl></projectUrl>
    <iconUrl></iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description></description>
    <releaseNotes></releaseNotes>
    <copyright>Copyright 2017</copyright>
    <tags>c# .net</tags>
    <dependencies>
        <dependency id="NETStandard.Library" version="1.6.1" />
    </dependencies>
    <references>
        <reference file="Solution.dll" />
    </references>
    </metadata>
    <files>
    <file src="Solution.dll" target="lib\netstandard1.6\Solution.dll"/>
    


file's node src value outpupath of my solution. (bin\Release\netstandard1.6\Solution.dll)

  1. Run nuget pack Solution.nuspec and Solution.nupkg file created.
  2. I put it to my package source.
  3. Create a new .net core class library and select my Solution nuget package from local package source. It added to my project. There is no error or warning. But When I try to access a class from my Solution nuget package, it couldn't be found.I dowloaded 'Nuget Package Explorer' and opened my Solution.nupkg. Icould see Solution.dll and Solution.pdb file under lib --> netstandart1.6.

Then I searched about the error and found this :

"scripts": {
"postcompile": [
  "dotnet pack --no-build --configuration %compile:Configuration%"
]
}

After compile my Solution project it creates Solution.1.0.0-0.nupkg file and Solution.1.0.0-0.symbols. I put it to my local package source but these packages are not listed in the 'Nuget Package Manager'.

Do you have any idea?

ayse
  • 93
  • 8

2 Answers2

0

My experience is creating package from solution sometimes crappy. Creating the package from the project file could solve the problem.

DigheadsFerke
  • 307
  • 1
  • 8
0

After I clean 'C:\Users\XXX.nuget\packages\Solution' folder and add package again fix my problem.

Because there is bad formatted nutget package which I tried before.

ayse
  • 93
  • 8