From f83436ee97c9aaf91dda5b74002ee29296879262 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Sat, 30 Aug 2025 20:29:03 -0300 Subject: [PATCH] Ensure dotnet build works too Both `ImportProjectExtensionProps` and `ImportProjectExtensionTargets` must be set to true, and we now use `MSBuildProjectExtensionsPath` to leverage the standard way of importing these targets. See https://github.com/dotnet/msbuild/issues/9512 Fixes https://github.com/devlooped/SmallSharp/issues/139 --- src/Demo/global.json | 2 +- src/SmallSharp/Sdk.props | 5 +++++ src/SmallSharp/SmallSharp.Before.props | 8 ++++++++ src/SmallSharp/SmallSharp.csproj | 3 ++- src/SmallSharp/SmallSharp.props | 8 ++++---- src/SmallSharp/SmallSharp.targets | 13 ++++++++----- 6 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 src/SmallSharp/SmallSharp.Before.props diff --git a/src/Demo/global.json b/src/Demo/global.json index 45f1c8c..9b93be7 100644 --- a/src/Demo/global.json +++ b/src/Demo/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "SmallSharp": "42.42.516-main" + "SmallSharp": "2.0.0" } } \ No newline at end of file diff --git a/src/SmallSharp/Sdk.props b/src/SmallSharp/Sdk.props index 37c619d..e085e05 100644 --- a/src/SmallSharp/Sdk.props +++ b/src/SmallSharp/Sdk.props @@ -2,6 +2,11 @@ + + true + true + + diff --git a/src/SmallSharp/SmallSharp.Before.props b/src/SmallSharp/SmallSharp.Before.props new file mode 100644 index 0000000..26d792a --- /dev/null +++ b/src/SmallSharp/SmallSharp.Before.props @@ -0,0 +1,8 @@ + + + + <_ImportProjectExtensionProps>$(ImportProjectExtensionProps) + <_ImportProjectExtensionTargets>$(ImportProjectExtensionTargets) + + + \ No newline at end of file diff --git a/src/SmallSharp/SmallSharp.csproj b/src/SmallSharp/SmallSharp.csproj index 67e81ef..f208055 100644 --- a/src/SmallSharp/SmallSharp.csproj +++ b/src/SmallSharp/SmallSharp.csproj @@ -32,11 +32,12 @@ + - + diff --git a/src/SmallSharp/SmallSharp.props b/src/SmallSharp/SmallSharp.props index 635d314..953b7f9 100644 --- a/src/SmallSharp/SmallSharp.props +++ b/src/SmallSharp/SmallSharp.props @@ -1,11 +1,11 @@ - - $(Features);FileBasedProgram - + + + $(MSBuildThisFileDirectory)\SmallSharp.Before.props + \ No newline at end of file diff --git a/src/SmallSharp/SmallSharp.targets b/src/SmallSharp/SmallSharp.targets index 2a3e570..681fd3e 100644 --- a/src/SmallSharp/SmallSharp.targets +++ b/src/SmallSharp/SmallSharp.targets @@ -8,9 +8,10 @@ $(ActiveDebugProfile) $(ActiveCompile) - CollectStartupFile;SelectStartupFile;SelectTopLevelCompile;UpdateLaunchSettings;EmitTargets - - $(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)SmallSharp.targets + EnsureImportProjectExtensions;CollectStartupFile;SelectStartupFile;SelectTopLevelCompile;UpdateLaunchSettings;EmitTargets + + + $(MSBuildProjectExtensionsPath)$(MSBuildProjectFile).smallsharp.targets @@ -30,6 +31,10 @@ + + + + @@ -162,8 +167,6 @@ - -