From dafcc8b9ad31ecea38d172fe7d4d0a4c6968ad67 Mon Sep 17 00:00:00 2001 From: James Groom Date: Tue, 27 Aug 2024 23:09:04 +1000 Subject: [PATCH] Updated C# and .NET docs supplement (markdown) --- C#-and-.NET-docs-supplement.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/C#-and-.NET-docs-supplement.md b/C#-and-.NET-docs-supplement.md index f51b74d..26216b0 100644 --- a/C#-and-.NET-docs-supplement.md +++ b/C#-and-.NET-docs-supplement.md @@ -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 ``/``. +## 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 ``ing a `.props` file, `$(ProjectDir)` is unset.