gpt4 book ai didi

azure - Azure 中的 .net core 3.1 发布任务错误

转载 作者:行者123 更新时间:2023-12-03 01:34:13 33 4
gpt4 key购买 nike

今天,我在 Azure 中发布 .netcore 应用程序 3.1 任务时遇到错误。 Publish error ,在谷歌上搜索后,我通过以下链接添加了另一个任务“使用.Net Core sdk 3.1”web URL并认为它会完成,但运行相同的错误,我使用的代理是“Window 2019”,请找到下面的日志,并告诉我我做错了什么。

2020-01-10T07:23:54.1832757Z ##[section]Starting: Publish
2020-01-10T07:23:54.1955402Z ==============================================================================
2020-01-10T07:23:54.1955499Z Task : .NET Core
2020-01-10T07:23:54.1955578Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2020-01-10T07:23:54.1955801Z Version : 2.162.0
2020-01-10T07:23:54.1955866Z Author : Microsoft Corporation
2020-01-10T07:23:54.1955930Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2020-01-10T07:23:54.1956023Z ==============================================================================
2020-01-10T07:23:54.9006939Z [command]C:\windows\system32\chcp.com 65001
2020-01-10T07:23:54.9110635Z Active code page: 65001
2020-01-10T07:23:55.3752628Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe publish d:\a\8\s\RINMVC.csproj --configuration $(BuildConfiguration) --output d:\a\8\a\s
2020-01-10T07:23:55.6992883Z Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
2020-01-10T07:23:55.6993590Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-01-10T07:23:55.6993774Z
2020-01-10T07:23:56.7768936Z d:\a\8\s\RINMVC.csproj : warning NU1701: Package 'System.Net.Http.Formatting.Extension 5.2.3' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
2020-01-10T07:23:56.7778950Z Restore completed in 48.65 ms for d:\a\8\s\RINMVC.csproj.
2020-01-10T07:23:57.1151368Z d:\a\8\s\RINMVC.csproj : warning NU1701: Package 'System.Net.Http.Formatting.Extension 5.2.3' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
2020-01-10T07:23:57.5687153Z C:\hostedtoolcache\windows\dotnet\sdk\3.1.100\Roslyn\Microsoft.CSharp.Core.targets(59,5): warning MSB3052: The parameter to the compiler is invalid, '/define:$(BUILDCONFIGURATION)' will be ignored. [d:\a\8\s\RINMVC.csproj]
2020-01-10T07:23:58.4874838Z Controllers\CompaniesController.cs(18,46): warning CS0169: The field 'CompaniesController.categoryViewModel' is never used [d:\a\8\s\RINMVC.csproj]
2020-01-10T07:24:01.5598101Z Could not find a part of the path 'd:\a\8\s\obj\$(BuildConfiguration)\netcoreapp3.1\Razor\Views\Cases\Add.cshtml.g.cs'.
2020-01-10T07:24:01.5599371Z at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
2020-01-10T07:24:01.5602238Z at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
2020-01-10T07:24:01.5602742Z at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
2020-01-10T07:24:01.5624368Z at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
2020-01-10T07:24:01.5624829Z at System.IO.StreamWriter..ctor(String path)
2020-01-10T07:24:01.5625325Z at System.IO.File.WriteAllText(String path, String contents)
2020-01-10T07:24:01.5625688Z at Microsoft.AspNetCore.Razor.Tools.GenerateCommand.ExecuteCore(RazorConfiguration configuration, String projectDirectory, String tagHelperManifest, SourceItem[] sourceItems)
2020-01-10T07:24:01.5626021Z at Microsoft.AspNetCore.Razor.Tools.GenerateCommand.ExecuteCoreAsync()
2020-01-10T07:24:01.5626352Z at Microsoft.AspNetCore.Razor.Tools.CommandBase.ExecuteAsync()
2020-01-10T07:24:01.5731592Z C:\hostedtoolcache\windows\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.CodeGeneration.targets(150,5): error : rzc generate exited with code 1. [d:\a\8\s\RINMVC.csproj]
2020-01-10T07:24:01.6262880Z ##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
2020-01-10T07:24:01.6277867Z ##[warning]Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x SDK/Runtime along with 2.2 & 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.
Some commonly encountered changes are:
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2020-01-10T07:24:01.6278863Z ##[error]Dotnet command failed with non-zero exit code on the following projects : d:\a\8\s\RINMVC.csproj
2020-01-10T07:24:01.6298381Z ##[section]Finishing: Publish

最佳答案

是的,我已经按照@silent的问题解决了这个问题

Did you declare the variable BuildConfiguration ?

由于测试目的,不幸的是,我已将变量(BuildConfiguration)删除到“变量”部分下的构建定义中,因此当我添加变量并保存定义时,它会按预期工作。

enter image description here

感谢@slient的反馈

关于azure - Azure 中的 .net core 3.1 发布任务错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59678658/

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