简体   繁体   中英

.netcore 3.1 Publish tasks error in Azure

today i am getting error on publish tasks of .netcore app 3.1 in Azure. Publish error , after getting search on google I have added another tasks "Use .Net Core sdk 3.1" by following this link web URL and thinks it will done but running same error, the Agent i am using is "Window 2019" please find the below log, and tell me what i am doing wrong.

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

Yes I have resolved the issue as per @silent question that

Did you declare the variable BuildConfiguration ?

Due to testing purpose unfortunately I have deleted the variable (BuildConfiguration) into build definition under Variables section, so when i added the variable and save the definition its works as expected.

在此处输入图片说明

Thanks for the feedback @slient

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM