Simplifications for samples
guardrex opened this issue Β· comments
It seems to work ok without "
paths and with a _TargetWebConfig
aimed at the $(PublishDir)
, which seems like it would simplify samples a bit (unless it's gonna π₯ otherwise).
<Target Name="RemoveHandlersFromWebConfig" AfterTargets="_WebConfigTransform">
<PropertyGroup>
<_SourceWebConfig>$(PublishDir)web.config</_SourceWebConfig>
<_XdtTransform>$(MSBuildThisFileDirectory)web.RemoveHandlers.config</_XdtTransform>
<_TargetWebConfig>$(PublishDir)web.config</_TargetWebConfig>
</PropertyGroup>
<Exec Command="dotnet transform-xdt --xml $(_SourceWebConfig) --transform $(_XdtTransform) --output $(_TargetWebConfig)" Condition="Exists('$(_XdtTransform)')" />
</Target>
... you may want the capitalized "W" tho in web.config
. I keep mine lowercase, but I am aware of the tradition of using Web.config
in projects out there. [Kind'a strange sometimes which conventions the .NET Core team kept and which ones they changed, since IIS.net is full of upper-case "W" Web.config
mentions.]
[EDIT] Is the "
path thing to cover spaces in paths?
Yup, the "
bit is for spaces and unfortunately must stay, although I agree it complicates the samples.
Let me try <_TargetWebConfig>$(PublishDir)web.config</_TargetWebConfig>
; the MSBuild gobbledygook I use now was mostly due to differences between what gets passed via dotnet publish
(relative path) and publishing inside VS (absolute path to somewhere under obj\PublishTmp). If $(PublishDir) works for both, we're golden.
Good feedback on consistency of naming, I will update to Web.config
everywhere; I just wish dotnet new -t web
would use the same π. Otherwise, sooner or later a Linux or Mac user will come calling.
Ok ... I thought so on the path thing. Since all of my paths are always no spaces, I'll be good for my own use of this to go no-"
for aesthetics.
You can see how well I've been trained ... or π₯ burned π₯ π ... on spaces in paths over the years. I never use spaces in paths for app dev paths or in filenames. I live a lot happier π this way.
Cool. I'll leave this for you to close then. I'm good on my questions. Paths with spaces peeps need to use "
... Peeps π» afraid π» of spaces in paths who never do that sort of thing, can drop the "
.
You were spot on about $(PublishDir)
, thanks! I just updated the samples with the much cleaner property: nil4/xdt-samples@2877962