簡體   English   中英

.netcore 3.1 在 Azure 中發布任務錯誤

[英].netcore 3.1 Publish tasks error in Azure

今天,我在 Azure 中發布 .netcore app 3.1 的任務時遇到錯誤。 發布錯誤,在 google 上進行搜索后,我添加了另一個任務“使用 .Net Core sdk 3.1”,並按照此鏈接網址,並認為它會完成但運行相同的錯誤,我使用的代理是“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://docs.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://docs.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 問題解決了這個問題

您是否聲明了變量 BuildConfiguration ?

不幸的是,由於測試目的,我已將變量 (BuildConfiguration) 刪除到變量部分下的構建定義中,因此當我添加變量並保存定義時,它按預期工作。

在此處輸入圖片說明

感謝您的反饋@slient

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM