-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<handlers> section is added to web.config when explicitly removed from source file #462
Comments
Probably a dup of aspnet/DotNetTools#175 If so, I'll track on the other issue for a fix. |
Looking at I think adding that property to your .csproj might unblock you. |
Thanks @nil4 👍 Adding ...
... to the The only thing devs need to keep in mind is that their Use of this property is probably "the answer" to this issue, so I'll close. |
@guardrex I just updated Add a <?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<handlers xdt:Transform="Remove" />
</system.webServer>
</configuration> Then add the following to your .csproj: <ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Xdt.Tools" Version="1.2.0-msbuild-preview4-004233" />
</ItemGroup>
<Target Name="RemoveHandlersFromWebConfig" AfterTargets="_WebConfigTransform">
<PropertyGroup>
<_SourceWebConfig>$(MSBuildThisFileDirectory)Web.config</_SourceWebConfig>
<_XdtTransform>$(MSBuildThisFileDirectory)Web.RemoveHandlers.config</_XdtTransform>
<_TargetWebConfig>$(MSBuildThisFileDirectory)$([MSBuild]::MakeRelative($(MSBuildThisFileDirectory), $(PublishIntermediateOutputPath)))Web.config</_TargetWebConfig>
</PropertyGroup>
<Exec
Command="dotnet transform-xdt --xml "$(_SourceWebConfig)" --transform "$(_XdtTransform)" --output "$(_TargetWebConfig)""
Condition="Exists('$(_XdtTransform)')" />
</Target> Now |
@nil4 Yes, except with the starting I tried running it on If I change the target to a different filename ( <PropertyGroup>
<_SourceWebConfig>$(PublishDir)web.config</_SourceWebConfig>
<_XdtTransform>$(MSBuildThisFileDirectory)web.RemoveHandlers.config</_XdtTransform>
<_TargetWebConfig>$(MSBuildThisFileDirectory)$([MSBuild]::MakeRelative($(MSBuildThisFileDirectory), $(PublishIntermediateOutputPath)))web2.config</_TargetWebConfig>
</PropertyGroup> ... starting with a content root <?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore stdoutLogEnabled="true" stdoutLogFile=".\logs\aspnetcore-stdout" />
</system.webServer>
</configuration> ... output <?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<aspNetCore stdoutLogEnabled="true" stdoutLogFile=".\logs\aspnetcore-stdout" processPath="dotnet" arguments=".\testportable.dll" />
</system.webServer>
</configuration> |
I added a repository with a couple of XDT usage samples, including this use case: https://github.com/nil4/xdt-samples |
@guardrex Yes, you're right, I see the same issue in the first sample. Let me see if I can find a way around it. |
@guardrex Complete silliness on my part; I was trying to write to the output file while the input file was still open, hence the lock error. Thanks for the report, it's fixed in version 1.2.0-msbuild-preview4-004234, published to nuget.org. |
@nil4 Confirmed fixed. Thanks. That's a nice transform system you built. When we get to 1.2 RTM and in the absence of a |
It's just a quick-and-dirty port of the CodePlex XDT code to .NET core, with known weaknesses around whitespace preservation and missing unit tests (as you can probably tell from the bug you just found 😀). It works well enough for my own needs, and apparently it's useful for other people too. If there's a chance to link it from the docs, that would be great. 👍 If (or rather when) you guys get to aspnet/Tooling#780, I would be happy to hand over the ownership of the NuGet package if that's something you are interested in. I published the first version under a Microsoft.* name without thinking. /cc @sayedihashimi |
The Sdk (or perhaps to me more precise
Sdk.Web
) is explicitly adding the<handlers>
section toweb.config
even when I have explicitly removed it.If the project includes a source
web.config
such as this ...on
dotnet publish
, theweb.config
file that appears in published output is ...The reason this is a problem is that my app in this case is a subapp, which cannot have a
<handlers>
section. Every publish, I must manually delete the<handlers>
section in the published outputweb.config
.The text was updated successfully, but these errors were encountered: