gpt4 book ai didi

.net-core - 出现奇怪的编译错误 - .Net Core

转载 作者:行者123 更新时间:2023-12-02 23:28:00 27 4
gpt4 key购买 nike

我不知道我最近做了什么。但这直到一周前才有效。当我尝试编译该项目时突然发生了。它给了我 8463 编译错误。下面给出了其中的一些。

enter image description here

如果你们中有人曾经遇到过这个问题,请帮助我。我正在使用 .net core 应用程序 1.0.0 。但我的电脑上也安装了 1.0.1。

当我尝试使用 dotnet build cli 进行编译时,我收到以下错误消息。

Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win7-x64'. Possible causes:

  1. The project has not been restored or restore failed - run dotnet restore
  2. The project does not list one of 'win7-x64' in the 'runtimes' section.
  3. You may be trying to publish a library, which is not supported. Use dotnet pack to distribute libraries.

我已经运行了dotnet Restore。我不确定第二点。因为它之前在同一台机器上运行过。

此外,我没有在 project.json 中提到任何 runtimes 部分

更新:

正如其他帖子中提到的。我添加了

  "runtimes": {
"win7-x64": { }
}

但没有成功。

项目.Json:

{
"userSecretsId": "aspnet-IdentityServer-db76f1cf-15a8-4dc0-8200-221a224b454c",
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Mvc": "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.StaticFiles": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"System.Security.Cryptography.Algorithms": "4.2.0",
"Serilog": "2.2.1",
"Serilog.Sinks.Literate": "2.0.0",
"Serilog.Extensions.Logging": "1.0.0",
"IdentityServer4": "1.0.0-beta5",
"IdentityManager.V2.Entities": "1.0.0-*",
"IdentityManager.V2.Data": "1.0.0-*",
"Microsoft.AspNetCore.Authentication.Google": "1.0.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
"Microsoft.AspNetCore.Authentication.Twitter": "1.0.0",
"Serilog.Sinks.Seq": "3.0.1",
"System.Runtime": "4.1.0"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},

"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net452+win81"
]
}
},

"runtimes": {
"win7-x64": {}
},

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

"runtimeOptions": {
"gcServer": true
},

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

"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

最佳答案

当我们更新软件包时,它会从
中删除“type”:“platform”“微软.NETCore.App”:{ “版本”:“1.1.0”, “类型”:“平台” }

在 Project.json 文件中。更新后,它看起来像 "Microsoft.NETCore.App": "1.1.0"。此错误的解决方案是使用此行更新 Json 文件,例如

“Microsoft.NETCore.App”:{ “版本”:“1.1.0”, “类型”:“平台” }

关于.net-core - 出现奇怪的编译错误 - .Net Core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39791134/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com