Вопрос:

«Задача« TransformWebConfig »неожиданно завершилась неудачей» при публикации dotnet

.net publish

1046 просмотра

1 ответ

18 Репутация автора

У меня возникла проблема при публикации веб-приложения ASP.NET Core 2.0.

На самом деле проект - это шаблон с открытым исходным кодом, который я создаю. Вы можете проверить это на: https://github.com/diegoortizmatajira/aspnetboilerplate_template

Приложение собирается и работает нормально, но когда я выполняю команду dotnet publish, оно показывает сообщение:

Задача «TransformWebConfig» неожиданно завершилась неудачей.

Приложению не нужен файл web.config (используется в IIS), так как ожидается, что он будет работать в док-контейнере Linux.

Результат выполнения отображается следующим образом:

user@laptop:~/codeworkshop/Templates/WebApiTemplate$ dotnet publish
Microsoft (R) Build Engine version 15.5.179.9764 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 45.95 ms for /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.Core/WebApiTemplate.Core.csproj.
  Restore completed in 42.53 ms for /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.Application/WebApiTemplate.Application.csproj.
  Restore completed in 44.98 ms for /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.EntityFrameworkCore/WebApiTemplate.EntityFrameworkCore.csproj.
  Restore completed in 5.89 ms for /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj.
  Restore completed in 38.66 ms for /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.EntityFrameworkCore/WebApiTemplate.EntityFrameworkCore.csproj.
  Restore completed in 26.94 ms for /home/user/codeworkshop/Templates/WebApiTemplate/test/WebApiTemplate.Test/WebApiTemplate.Test.csproj.
  Restore completed in 48.07 ms for /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj.
  Restore completed in 50.32 ms for /home/user/codeworkshop/Templates/WebApiTemplate/test/WebApiTemplate.WebApi.Test/WebApiTemplate.WebApi.Test.csproj.
  Restore completed in 16.46 ms for /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj.
  WebApiTemplate.Core -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.Core/bin/Debug/netstandard2.0/WebApiTemplate.Core.dll
  WebApiTemplate.Core -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.Core/bin/Debug/netstandard2.0/publish/
  WebApiTemplate.Application -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.Application/bin/Debug/netstandard2.0/WebApiTemplate.Application.dll
  WebApiTemplate.EntityFrameworkCore -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.EntityFrameworkCore/bin/Debug/netstandard2.0/WebApiTemplate.EntityFrameworkCore.dll
  WebApiTemplate.EntityFrameworkCore -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.EntityFrameworkCore/bin/Debug/netstandard2.0/publish/
  WebApiTemplate.Application -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.Application/bin/Debug/netstandard2.0/publish/
  WebApiTemplate.Test -> /home/user/codeworkshop/Templates/WebApiTemplate/test/WebApiTemplate.Test/bin/Debug/netcoreapp2.0/WebApiTemplate.Test.dll
  WebApiTemplate.WebApi -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/bin/Debug/netcoreapp2.0/WebApiTemplate.WebApi.dll
  WebApiTemplate.WebApi -> /home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/bin/Debug/netcoreapp2.0/publish/
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018: The "TransformWebConfig" task failed unexpectedly. [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018: System.ArgumentOutOfRangeException: Length cannot be less than zero. [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018: Parameter name: length [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.String.Substring(Int32 startIndex, Int32 length) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Uri.CreateHostStringHelper(String str, UInt16 idx, UInt16 end, Flags& flags, String& scopeId) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Uri.CreateHostString() [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Uri.EnsureHostString(Boolean allowDnsOptimization) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Uri.GetComponentsHelper(UriComponents uriComponents, UriFormat uriFormat) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Uri.ToString() [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options) [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at Microsoft.NET.Sdk.Publish.Tasks.TransformWebConfig.Execute() [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() in E:\A\_work\45\s\src\Build\BackEnd\TaskExecutionHost\TaskExecutionHost.cs:line 631 [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
/usr/share/dotnet/sdk/2.1.3/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(46,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() in E:\A\_work\45\s\src\Build\BackEnd\Components\RequestBuilder\TaskBuilder.cs:line 787 [/home/user/codeworkshop/Templates/WebApiTemplate/src/WebApiTemplate.WebApi/WebApiTemplate.WebApi.csproj]
  WebApiTemplate.Test -> /home/user/codeworkshop/Templates/WebApiTemplate/test/WebApiTemplate.Test/bin/Debug/netcoreapp2.0/publish/
  WebApiTemplate.WebApi.Test -> /home/user/codeworkshop/Templates/WebApiTemplate/test/WebApiTemplate.WebApi.Test/bin/Debug/netcoreapp2.0/WebApiTemplate.WebApi.Test.dll
  WebApiTemplate.WebApi.Test -> /home/user/codeworkshop/Templates/WebApiTemplate/test/WebApiTemplate.WebApi.Test/bin/Debug/netcoreapp2.0/publish/

Моя настройка разработки:

Herramientas de la línea de comandos .NET (2.1.3)

Product Information:
 Version:            2.1.3
 Commit SHA-1 hash:  a0ca411ca5

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  17.10
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.3/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.4
  Build    : 7f262f453d8c8479b9af91d34c013b3aa05bc1ff

Но это также дает сбой при публикации внутри контейнера.

Автор: Diego Leonard Ortiz Matajira Источник Размещён: 08.01.2018 01:04

Ответы (1)


0 плюса

76 Репутация автора

Это ошибка :( Попробуйте обновить визуальную студию. Если это не решит вашу проблему. Вы можете отредактировать ваш файл .csproj в веб-проекте и удалить эту строку:

<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>

Что такое модель хостинга Inprocess?

https://dotnettutorials.net/lesson/asp-net-core-inprocess-hosting/

Автор: Sinan Bozkuş Размещён: 10.05.2019 08:28
Вопросы из категории :
32x32