Skip to content

Commit 5398d3b

Browse files
authored
Only include web.$(Configuration).config where xxxx exists on disk. Fixes #67 (#68)
* Only include web.xxxx.config for configurations, where xxxx exists on disk. Fixes #67 * Adjust plurality of itemgroup names, and add additional exists checks.
1 parent 5b05c6f commit 5398d3b

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"msbuild-sdks": {
88
"Microsoft.Build.NoTargets": "2.0.1",
9-
"MSBuild.SDK.SystemWeb": "4.0.82",
10-
"MSBuild.SDK.SystemWeb.RazorLibrary": "4.0.82"
9+
"MSBuild.SDK.SystemWeb": "4.0.88",
10+
"MSBuild.SDK.SystemWeb.RazorLibrary": "4.0.88"
1111
}
1212
}

src/MSBuild.SDK.SystemWeb/Sdk/MSBuild.SDK.SystemWeb.DefaultItems.props

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,22 @@
88

99
<ItemGroup Condition="'$(EnableWebFormsDefaultItems)'=='true'">
1010
<Content Include="Web.config" />
11-
<_WebConfigConfigurations Include="$(Configurations)" />
12-
<None Include="@(_WebConfigConfigurations->'Web.%(Identity).config')">
13-
<DependentUpon>Web.config</DependentUpon>
14-
</None>
11+
<!-- web.*.config where * is a Configuration type (used for transforms) fixes #67 -->
12+
<_WebConfigConfiguration Include="$(Configurations)" Exclude="@ExcludeWebConfigConfiguration">
13+
<Configuration>%(Identity)</Configuration>
14+
</_WebConfigConfiguration>
15+
<_WebConfigConfigurationFile Include="@(_WebConfigConfiguration->'Web.%(Identity).config')" >
16+
<DependentUpon Condition="EXISTS('Web.config')">Web.config</DependentUpon>
17+
<CurrentConfiguration>false</CurrentConfiguration>
18+
<CurrentConfiguration Condition="'$(Configuration)'=='%(Configuration)'">true</CurrentConfiguration>
19+
<!-- The following could be extended to allow applying transforms based on the configuration in a hierarchical way. See notes in PR #68 -->
20+
<!--<ApplyConfiguration>false</ApplyConfiguration>
21+
<ApplyConfiguration Condition="'$(Configuration)'=='%(Configuration)'">true</ApplyConfiguration>
22+
<ApplyConfiguration Condition="$(Configuration.StartsWith('%(Configuration).'))">true</ApplyConfiguration>-->
23+
</_WebConfigConfigurationFile>
24+
<None Include="@(_WebConfigConfigurationFile->Exists())" />
1525
<None Include="Web.BindingRedirects.config" Condition="EXISTS('Web.BindingRedirects.config')">
16-
<DependentUpon>Web.config</DependentUpon>
26+
<DependentUpon Condition="EXISTS('Web.config')">Web.config</DependentUpon>
1727
</None>
1828

1929
<!-- Altered web.*.config inclusion so these items will be in the WebDeploy Package

0 commit comments

Comments
 (0)