I create a new .net core class library with the following project.json file:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
},
"frameworks": {
"netstandard1.5": {
"imports": "dnxcore50"
}
},
"scripts": {
"postcompile": [
"dotnet pack --no-build --configuration %compile:Configuration%"
]
}
}
With the "scripts" > "postcompile" I am exporting the nuget package for this library which outputs these files and folder:
/netstandard1.5
Solid.Common.Log.1.0.0.nupkg
Solid.Common.Log.1.0.0.symbols.nupkg
After this step, I am copying these files into my local nuget folder which I set up before on Visual Studio.
And here is the other project's project.json file (.net core web application) which i want to add the nuget package above.
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Solid.Common.Log": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Everything looks fine but it says "Unable to resolve...". Here is the output:
PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
C:\Program Files\dotnet\dotnet.exe restore "D:\Projects\Playground\Solid.Disaster\.vs\restore.dg"
log : Restoring packages for D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\project.json...
info : CACHE https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/index.json
info : CACHE https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethost/index.json
warn : The folder 'D:\Projects\MyNuget\Solid.Common.Log\netstandard1.5' contains an invalid version.
info : GET https://api.nuget.org/v3-flatcontainer/solid.common.log/index.json
info : NotFound https://api.nuget.org/v3-flatcontainer/solid.common.log/index.json 923ms
error: Unable to resolve 'Solid.Common.Log (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
log : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\project.json...
info : Committing restore...
log : Writing lock file to disk. Path: D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\project.lock.json
log : D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\Solid.Disaster.Web.xproj
log : Restore failed in 1670ms.
Errors in D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\Solid.Disaster.Web.xproj
Unable to resolve 'Solid.Common.Log (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
NuGet Config files used:
C:\Users\SolidWrist\AppData\Roaming\NuGet\NuGet.Config
C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://api.nuget.org/v3/index.json
D:\Projects\MyNuget
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
What might be the problem here? Why can not it resolve this nuget package?
If I add Solid.Common.Log project to web project as an existing project and reference it, everything works fine. But when I try to add it as a nuget package, I am getting this error.
Thanks.