Updated C# and .NET docs supplement (markdown)

James Groom 2024-08-27 23:09:04 +10:00
parent 32dfca4cf1
commit dafcc8b9ad
1 changed files with 12 additions and 0 deletions

@ -40,6 +40,18 @@ You can only have 1 `default` branch, but `case _ when ...:` doesn't work. Howev
On (older versions of?) VS, `Condition` is ignored if placed on a property/item. Create a new `<PropertyGroup/>`/`<ItemGroup/>`.
## MSBuild project evaluation (without build)
[`dotnet publish --getProperty`](https://learn.microsoft.com/en-us/visualstudio/msbuild/evaluate-items-and-properties#use-command-line-options-to-output-values)
Example:
```
$> dotnet publish --getProperty:IsTargetingNetFramework src/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
False
$> dotnet publish --getProperty:IsTargetingNetFramework src/BizHawk.WinForms.Controls/BizHawk.WinForms.Controls.csproj
True
```
## MSBuild path properties
Always use `$(MSBuildProjectDirectory)` rather than `$(ProjectDir)` (note that the former doesn't include a trailing slash), because when `<Import/>`ing a `.props` file, `$(ProjectDir)` is unset. <!-- TODO only during property evaluation? -->