2017-04-24 52 views
2

我想在MacOS上運行一個asp.net核心1.1 web應用程序。我已經下載了所有最新版本的.NET包括SDK(目前1.0.3) 當我運行dotnet restore順利的,但是當我嘗試建立或運行應用程序,我收到此錯誤信息:project.assets.json找不到

JSON:EC json$ dotnet run 
/usr/local/share/dotnet/sdk/1.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(154,5): error : Assets file ‘/Users/jasonfenwick/Documents/Account Creation and Dashboard/EmptyCubicle/EmptyCubicle/obj/project.assets.json’ not found. Run a NuGet package restore to generate this file. [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(6,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(7,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(8,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(9,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(10,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(11,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(12,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(13,12): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(6,55): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(7,61): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(8,59): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(9,59): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(10,68): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(11,55): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(12,53): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(13,55): error CS0518: Predefined type ‘System.String’ is not defined or imported [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(3,7): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
obj/Debug/netcoreapp1.1/EmptyCubicle.AssemblyInfo.cs(4,7): error CS0246: The type or namespace name ‘System’ could not be found (are you missing a using directive or an assembly reference?) [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 
/usr/local/share/dotnet/sdk/1.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Sdk.targets(92,5): error : Assets file ‘/Users/jasonfenwick/Documents/Account Creation and Dashboard/EmptyCubicle/EmptyCubicle/obj/project.assets.json’ not found. Run a NuGet package restore to generate this file. [/Users/jasonfenwick/Documents/Account%20Creation%20and%20Dashboard/EmptyCubicle/EmptyCubicle/EmptyCubicle.csproj] 

The build failed. Please fix the build errors and run again. 

我收集到該程序正在尋找一個project.assets.json文件,該文件是在運行「dotnet restore」時創建的。並且在正確的文件夾中。

我嘗試刪除此文件並重新運行dotnet restore,從而重新創建該文件。但錯誤仍然存​​在。

+0

嘗試刪除項目中的bin /和obj /文件夾,並執行另一個dotnet恢復。這對我來說修復了類似的問題,看起來文件沒有正確恢復。 – Anthony

+0

你也可以發佈你的'.csproj'文件嗎?併發布運行'dotnet恢復'的輸出。有時在恢復期間有錯誤很容易錯過。 –

+0

我在部署到VSTS的Windows 2017主機計算機上也遇到此問題。 – code

回答

0

嘗試升級到Nuget 4.x,它應該生成缺少的project.assets.json。