Sdk: Excluding web.config from publish

Created on 29 Sep 2017  路  2Comments  路  Source: dotnet/sdk

Steps to reproduce

Do not add web.config to Asp.Net Core project. Publish project through VS2017 to folder.
Publish output contains web.config.

Same happens even when web.config is explicitly excluded from publish in project file:
<None Update="web.config" CopyToPublishDirectory="Never" />

Expected behavior

Publish output will not contain web.config

Actual behavior

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9

Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Most helpful comment

@petronellius Use ...

<PropertyGroup>
  <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>

... in your project file. See: https://docs.microsoft.com/aspnet/core/publishing/iis#webconfig

All 2 comments

@petronellius Use ...

<PropertyGroup>
  <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>

... in your project file. See: https://docs.microsoft.com/aspnet/core/publishing/iis#webconfig

@guardrex Fantastic, it's working. Thanks.

Was this page helpful?
0 / 5 - 0 ratings