Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The "TransformWebConfig" task failed unexpectedly - System.Exception: The acceptable value for AspNetCoreModuleHostingModel property is either

Tags:

asp.net-core

I get

'The "TransformWebConfig" task failed unexpectedly. System.Exception: The acceptable value for AspNetCoreModuleHostingModel property is either "InProcess" or "OutOfProcess".'

error while publishing an ASP.NET Core 2.2.0 application (actually it is the included sample application) for win-x64 environment. Both Visual Studio 2017 and 2019 gives the same error. I am working on Windows 10. What should I do to solve this? Last part of publish Output is:

c:\users\engin\source\repos\NetCoreWebApplication2\NetCoreWebApplication2\obj\Release\netcoreapp2.2\win-x64\PubTmp\Out\ C:\Program Files\dotnet\sdk\2.2.200-preview-009648\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets(49,5): Hata MSB4018: "TransformWebConfig" görevi beklenmedik biçimde başarısız oldu. System.Exception: The acceptable value for AspNetCoreModuleHostingModel   property is either "InProcess" or "OutOfProcess".    konum: Microsoft.NET.Sdk.Publish.Tasks.WebConfigTransform.TransformAspNetCore(XElement aspNetCoreElement, String appName, Boolean configureForAzure, Boolean useAppHost, String extension, String aspNetCoreModuleName, String aspNetCoreHostingModel)    konum: Microsoft.NET.Sdk.Publish.Tasks.WebConfigTransform.Transform(XDocument webConfig, String appName, Boolean configureForAzure, Boolean useAppHost, String extension, String aspNetCoreModuleName, String aspNetCoreHostingModel, String environmentName)    konum: Microsoft.NET.Sdk.Publish.Tasks.TransformWebConfig.Execute()    konum: Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()    konum: Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()  2 Derleme başarısız oldu. Daha fazla ayrıntı için çıktı penceresini denetleyin. ========== Oluşturma: 1 başarılı, 0 başarısız, 0 güncel, 0 atlandı ========== ========== Yayın: 0 başarılı, 1 başarısız, 0 atlandı ========== 
like image 248
Kellad Avatar asked Dec 27 '18 10:12

Kellad


2 Answers

I would suggest disabling web.config transforms altogether. In an ASP.Net Core project you probably do not need to transform web.configs since supplying environment variables is handled by convention with appsettings.[Environment].json files.

From the docs at https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2:

To prevent the Web SDK from transforming the web.config file, use the <IsTransformWebConfigDisabled> property in the .csproj file:

<PropertyGroup>    <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled> </PropertyGroup> 
like image 66
Andy Raddatz Avatar answered Sep 21 '22 09:09

Andy Raddatz


I had the same problem and found the solution

In the csproj file, find following line and delete.

<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> 
like image 25
Barış Bar Avatar answered Sep 21 '22 09:09

Barış Bar