From a0228acdb1785a0383b05c1ad19846495e5d5168 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Thu, 9 Apr 2026 20:35:30 -0300 Subject: [PATCH] Add support for linked files Now you can have a single project, linking files from arbitrary locations for the purpose of F5 debugging from VS! --- src/SmallSharp/SmallSharp.targets | 60 ++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/src/SmallSharp/SmallSharp.targets b/src/SmallSharp/SmallSharp.targets index b1781c4..63c2a9c 100644 --- a/src/SmallSharp/SmallSharp.targets +++ b/src/SmallSharp/SmallSharp.targets @@ -14,7 +14,7 @@ $(S) $(ActiveDebugProfile) true - EnsureProperties;CollectStartupFile;SelectStartupFile;SelectTopLevelCompile;UpdateLaunchSettings;EmitTargets + EnsureProperties;CollectStartupFile;ResolveStartupFile;SelectStartupFile;SelectTopLevelCompile;UpdateLaunchSettings;EmitTargets $(MSBuildProjectExtensionsPath)$(MSBuildProjectFile).smallsharp.props @@ -25,10 +25,19 @@ + + + + <_LinkedCompile Include="@(Compile -> HasMetadata('Link'))" /> + <_NuGetLinked Include="@(_LinkedCompile -> HasMetadata('NuGetPackageId'))" /> + <_NoNuGetLinked Include="@(_LinkedCompile)" Exclude="@(_NuGetLinked)" /> + + + @@ -51,7 +60,19 @@ + + + + + + + + <_MatchingStartupFile Include="@(StartupFile)" Condition="'$(StartupFile)' != '' and '%(Filename)%(Extension)' == '$(StartupFile)'" /> + + @(_MatchingStartupFile -> '%(Identity)') + false + @@ -146,6 +167,8 @@ + + @@ -202,4 +225,39 @@ + + + + + + + + + + + + i.ItemSpec)) + { + Log.LogMessage(MessageImportance.High, "{0}: {1}", itemName, item.ItemSpec); + foreach (var name in item.MetadataNames.OfType().OrderBy(_ => _)) + { + try + { + Log.LogMessage(MessageImportance.High, "\t{0}={1}", name, item.GetMetadata(name)); + } + catch { } + } + } + ]]> + + + +