2016-07-14 18 views
0

Nach dem Upgrade auf netcoreapp1.0 kann ich mein Projekt nicht ausführen. Ich habe alle Fehler und Fixes für das Update gelöst, Pakete wiederhergestellt und nirgendwo Fehler bekommen.So beheben Sie die Objektverweisausnahme nach der Aktualisierung von dotnet core auf 1.0.0-preview2-003121

(folgte ich diesen Leitfaden für https://docs.microsoft.com/en-us/dotnet/articles/core/migrating-from-dnx Upgrade)

Alles, was ich bekommen ist die klassische Object reference not set to an instance of an object. die Art Muttern der mich antreibt.

Befehl Ausführen

$ dotnet run 
Object reference not set to an instance of an object. 

Meine Werkzeuge:

$ dotnet --info 

.NET Command Line Tools (1.0.0-preview2-003121) 

Product Information: 
Version:   1.0.0-preview2-003121 
Commit SHA-1 hash: 1e9d529bc5 

Runtime Environment: 
OS Name:  Mac OS X 
OS Version: 10.10 
OS Platform: Darwin 
RID:   osx.10.10-x64 

(Auch lief auf meinem Win 10 Kasten mit dem gleichen Ergebnis, nicht in der Lage von cmd oder Visual Studio als auch laufen)

Die gibt auch nichts aus.

Irgendwelche Ideen, wie man es festnagelt?

UPDATE:

project.json 

{ 
    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.0.0", 
     "type": "platform" 
    }, 
    "Microsoft.AspNetCore.Mvc": "1.0.0", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0", 
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", 
    "Microsoft.Extensions.Logging": "1.0.0", 
    "Microsoft.Extensions.Logging.Console": "1.0.0", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", 
    "System.Diagnostics.Process" : "4.1.0" 
    }, 

    "tools": { 
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" 
    }, 

    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": [ 
     "dotnet5.6", 
     "portable-net45+win8" 
     ] 
    } 
    }, 

    "buildOptions": { 
    "emitEntryPoint": true, 
    "preserveCompilationContext": true 
    }, 

    "runtimeOptions": { 
    "configProperties": { 
     "System.GC.Server": true 
    } 
    }, 

    "publishOptions": { 
    "include": [ 
     "wwwroot", 
     "Views", 
     "Areas/**/Views", 
     "appsettings.json", 
     "web.config" 
    ] 
    }, 

    "scripts": { 
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 
    }, 

    "tooling": { 
    "defaultNamespace": "Avantime.Sniff" 
    } 
} 
+0

Nur um es ganz klar zu machen: Sagen Sie, dass das Ausführen von 'dotnet restore' und' dotnet build' erfolgreich ist, aber nur 'dotnet run' scheitert? Könnten Sie Ihr Projekt.json posten? – svick

+0

Ja, genau das passiert. –

Antwort

0

nicht sicher, was den Fehler verursacht hat oben, aber nach verschiedenen Release-Notes auf Github und kleinere Korrekturen war dies die notwendigen Anpassungen zu lesen, um es zu arbeiten.

Auch mit viel Arbeit entfernen alle Verweise auf alte Bibliotheken je nach älterem Code als netcore50 (meist Update EF7 zu EntityFrameworkCore) in Code.

Mein fixen:

Added Program.cs als neuer Einstiegspunkt für die Anwendung

public static class Program 
    { 
     public static void Main(string[] args) 
     { 
      var host = new WebHostBuilder() 
       .UseKestrel() 
       .UseContentRoot(Directory.GetCurrentDirectory()) 
       .UseIISIntegration() 
       .UseStartup<Startup>() 
       .Build(); 

      host.Run(); 

     } 
    } 

Fest Startup Signatur nach diesem: https://github.com/aspnet/Announcements/issues/171

 public Startup(IHostingEnvironment env) 
     { 
      // Setup configuration sources. 
      var builder = new ConfigurationBuilder() 
       .SetBasePath(env.ContentRootPath) 
       .AddJsonFile("config.json"); 

      [...] 

Changed package.json zu

{ 
    "dependencies": { 
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0", 
    "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0", 
    "Microsoft.AspNetCore.Diagnostics": "1.0.0", 
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", 
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0", 
    "Microsoft.AspNetCore.Mvc": "1.0.0", 
    "Microsoft.AspNetCore.Mvc.Core": "1.0.0", 
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", 
    "Microsoft.AspNetCore.Session": "1.0.0", 
    "Microsoft.AspNetCore.StaticFiles": "1.0.0", 
    "Microsoft.EntityFrameworkCore": "1.0.0", 
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0", 
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0", 
    "Microsoft.Extensions.Logging.Console": "1.0.0", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0", 
    "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2", <-- IMPORTANT 
    "Microsoft.Extensions.PlatformAbstractions": "1.0.0" <-- IMPORTANT 
    }, 

    "buildOptions": { 
    "compile": { 
     "include": [ 
     "../../shared/**/*.cs" 
     ] 
    }, 
    "copyToOutput": { 
     "include": [ 
     "Areas", 
     "Views", 
     "wwwroot", 
     "config.json", 
     "web.config" 
     ] 
    }, 
    "define": [ 
     "DEMO", 
     "TESTING" 
    ], 
    "emitEntryPoint": true, <- IMPORTANT 
    "preserveCompilationContext": true, 
    "warningsAsErrors": false 
    }, 
    "publishOptions": { 
    "include": [ 
     "Areas", 
     "Views", 
     "wwwroot", 
     "config.json", 
     "web.config" 
    ] 
    }, 

    "runtimeOptions": { 
    "configProperties": { 
     "System.GC.Server": true 
    } 
    }, 
    "frameworks": { 
    "netcoreapp1.0": { 
     "Microsoft.NETCore.App": { 
     "version": "1.0.0-*", 
     "type": "platform" 
     }, 
     "imports": [ "netcore50", "portable-net452+win81" ] <- IMPORTANT 
    } 

    }, 
    "tools": { 
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-*" 
    }, 
    "scripts": { 
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" 
    }, 
    "webroot": "wwwroot", 
    "version": "1.0.0-*", 
    "runtimes": { 
    "win10-x64": {} 
    } 
}