gpt4 book ai didi

git - 部署 ASP.Net MVC .Net Core 应用程序时出现错误 MSB4025

转载 作者:行者123 更新时间:2023-12-02 08:06:34 25 4
gpt4 key购买 nike

我正在尝试部署在 Visual Studio Code 中的 Ubuntu 16.04 系统上创建的 ASP.Net MVC .Net Core 应用程序。当尝试将本地 git 部署推送到我的 Azure 应用程序到其 Azure 应用程序服务时。在项目的根目录中,我运行了以下命令:

git push -u azure master

并得到以下结果:

D:\home\site\repository\project.json(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1. remote: Failed exitCode=1, command=dotnet publish "project.json" --output "D:\local\Temp\8d436b77fda50dd" --configuration Release remote: An error has occurred during web site deployment. remote: remote: Error - Changes committed to remote repository but deployment to website failed. To https: //[email protected]:443/mayappname.git * [new branch] master -> master Branch master set up to track remote branch master from azure.

从 Bitbucket 上的相同存储库进行部署时,我收到了几乎相同的错误消息。

我在处理持续集成平台时发现了对此错误的引用,但其他人在尝试部署 ASP.Net MVC .Net Core 应用程序时是否见过此错误?这是project.json 文件:

{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"Microsoft.EntityFrameworkCore": "1.1.*",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer":"1.1.*",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.1.0-preview4-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
},

"tools": {
"BundlerMinifier.Core": "2.2.306",
"Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.1.0-preview4-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},

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

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

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

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

"scripts": {
"precompile": [ "dotnet bundle" ],
"prepublish": [ "bower install" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},

"tooling": {
"defaultNamespace": "myNameSpace"
}
}

最佳答案

解决方案是将 global.json 文件添加到包含 .net core SDK 版本的根目录:

{
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
}

如果没有 global.json 文件,Azure 持续集成过程将尝试使用 MSBuild 构建基于 project.json 的项目,但该项目将无法工作。请参阅https://github.com/aspnet/Mvc/blob/dev/global.json

关于git - 部署 ASP.Net MVC .Net Core 应用程序时出现错误 MSB4025,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41527391/

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