ich eine neue .net Kernklassenbibliothek mit der folgenden project.json-Datei zu erstellen:.net Kern RC2 eigenes lokales Nuget Paket mit: Der Ordner netstandard1.5 enthält eine ungültige Version
{
"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%"
]
}
}
Mit dem „scripts ">‚postcompile‘ich bin Export der nuget Paket für diese Bibliothek, die diese Dateien und Ordner gibt:
/netstandard1.5
Solid.Common.Log.1.0.0.nupkg
Solid.Common.Log.1.0.0.symbols.nupkg
nach diesem Schritt kopiere ich diese Dateien in meinem lokalen nuget Ordner, die ich zuvor auf Visual Studio einrichten .
Und hier ist die Projekt.json Datei des anderen Projekts (.net Kern-Webanwendung), die ich das nuget-Paket oben hinzufügen möchte.
{
"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%" ]
}
}
Alles sieht gut aus, aber es sagt "Unable to resolve ...". Hier ist die Ausgabe:
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\
Was könnte das Problem hier sein? Warum kann dieses nuget-Paket nicht aufgelöst werden?
Wenn ich das Solid.Common.Log-Projekt als vorhandenes Projekt zum Webprojekt hinzufüge und darauf verweise, funktioniert alles einwandfrei. Aber wenn ich versuche, es als nugget-Paket hinzuzufügen, bekomme ich diesen Fehler.
Danke.
Wenn ich das Paket produzieren wird direkt in das MyNuget Verzeichnis setzen, es funktioniert gut für mich. Ich weiß nicht, was der Fehler "ungültige Version" bedeutet. – svick
@svick, was ist Ihre nugget Paketmanager Version? Meins ist 3.4.4 –
Warum verwenden Sie Visual Studio nicht und sehen, wie es die Referenz generiert? –