找不到project.assets.json

时间:2017-04-24 17:46:23

标签: macos asp.net-core .net-core

我正在尝试在MacOS上运行asp.net core 1.1 Web应用程序。我已经下载了所有最新版本的.NET,包括SDK(目前为1.0.3) 当我运行dotnet restore事情进展顺利但当我尝试构建或运行应用程序时,我收到此错误消息:

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.

我收集到该程序正在查找在运行“dotnet restore”时创建的project.assets.json文件。并且是否在正确的文件夹中。

我尝试删除此文件并重新运行dotnet restore,从而重新创建文件。但错误仍然存​​在。

2 个答案:

答案 0 :(得分:2)

使用NuGet 4.x(在VSTS中的NuGet安装程序任务中可用)是恢复VS 2017项目包的推荐方法。参考https://github.com/Microsoft/vsts-tasks/issues/3762

答案 1 :(得分:0)

尝试升级到Nuget 4.x,它应该生成缺少的project.assets.json。