Commit 32f72db
authored
Allows the Visual Studio Settings Designer to read from and write to Web.config (#97)
# Summary
Closes #95 - where opening or using the Settings Designer in Visual Studio creates a new `App.config` and writes settings there, instead of using `Web.config`.
# What this change does
When `App.config` does not exist, we link `Web.config` as `App.config` (hidden & not part of the project) so the designer "finds" an `App.config`, but actually reads/writes `Web.config`.
# Rationale
The .NET Settings Designer expects `App.config`. In Web projects that only have `Web.config`, the designer creates a new `App.config` and starts using it, which is undesirable for ASP.NET. By linking `Web.config` as `App.config` (keeping it out of Solution Explorer to avoid clutter), the designer stays happy and all settings end up in Web.config, without leaving behind a stray `App.config`.
# Behavior & edge cases
- If `App.config` already exists: nothing changes; we do not add the linked item
- If `Web.config` is missing: nothing changes; no link is added
#Manual verification steps
- Create an SDK-style ASP.NET 4.x project with only Web.config (no App.config) - e.g. dotnet new -i systemwebfull
- Open in Visual Studio -> Project Properties -> Settings -> "Create or open application settings"
- Add a new setting
- Expected: VS Settings Designer writes to `Web.config`; no `App.config` file is created on disk or added to the project
- Add a real `App.config` and repeat
- Expected: the SDK does not add the link, designer uses the existing App.config (no behavior change from today)
#Backwards compatibility
Fully backwards compatible:
- Projects already using App.config are unaffected
- Projects with only Web.config get the desired designer behavior1 parent 6aabca7 commit 32f72db
File tree
1 file changed
+9
-0
lines changed- src/MSBuild.SDK.SystemWeb/Sdk
1 file changed
+9
-0
lines changedLines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
34 | 43 | | |
35 | 44 | | |
36 | 45 | | |
| |||
0 commit comments