diff --git a/C#-and-.NET-docs-supplement.md b/C#-and-.NET-docs-supplement.md index 4b385c8..0beff3c 100644 --- a/C#-and-.NET-docs-supplement.md +++ b/C#-and-.NET-docs-supplement.md @@ -31,12 +31,14 @@ You can only have 1 `default` branch, but `case _ when ...:` doesn't work. Howev ## MSBuild `Condition` placement -On (older versions of?) VS, `Condition` is ignored if placed on a property/item. Create a new ``. +On (older versions of?) VS, `Condition` is ignored if placed on a property/item. Create a new ``/``. -## MSBuild property evaluation execution order +## MSBuild path properties -When ``ing a `.props` file, `ProjectDir` is unset (but `SolutionDir` *is* set, if applicable). -Use `MSBuildProjectDirectory`. Note that the latter doesn't include a trailing slash. +Always use `$(MSBuildProjectDirectory)` rather than `$(ProjectDir)` (note that the former doesn't include a trailing slash), because when ``ing a `.props` file, `$(ProjectDir)` is unset. +(`$(SolutionDir)` *is* set, but that should be avoided even in the main solution.) + +Use `$(TargetPath)` rather than reconstructing e.g. `$(OutputPath)$(MSBuildProjectName).dll`. ## `Newtonsoft.Json` footguns