【发布时间】:2017-02-24 15:27:30
【问题描述】:
我从这个链接下载了“.NET Core 1.0.1 tools Preview 2”: https://www.microsoft.com/net/core#windowsvs2015
当我启动我的 Visual Studio 时,我尝试清理并重建我创建的项目 (ASP.NET Core)。
重建时,我从 ASPNETCore 库和扩展中收到很多错误,因此下一步是尝试通过包管理器控制台调用 dotnet restore。
但是我得到了这个错误:
“错误:从 JsonReader 读取 JToken 时出错。路径 '',第 1 行, 位置 1454。”
知道我忘记了什么吗?
解决我的问题的步骤:
- 安装 DotNetCore
- 启动 Visual Studio 并创建 ASP.NET Core Web 应用程序 (.NET Core)
- 创建项目后清理并重建
- 如果不起作用,请转到包管理器控制台并输入“dotnet restore”
我的问题的片段:(
project.json 文件:
{
"dependencies": {
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "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",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net46": { }
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
【问题讨论】:
-
也许您更改了
nuget.Config中的 nuget 存储库配置设置,这就是为什么它找不到任何 nuget 包的原因?如果在项目目录下手动运行dotnet restore会怎样? -
根本没有更改 nuget.Config 中的任何内容。我通过powershell手动运行了dotnet restore。仍然得到同样的错误
-
您定义的依赖项是什么,似乎有些地方出错了。也许 nuget 试图读取一些东西,但它的响应很长,所以它被截断,Jreader 无法解析字符串。但我对你没有解决方案。 (您可以使用 fiddler 查看
dotnet restore时发生的 http 请求。 -
你能用
project.json更新你的问题吗? -
好的,我已经添加了
标签: c# visual-studio asp.net-core .net-core