Skip to content

Commit ed43989

Browse files
committed
feat(sdk): auto-generate launchSettings.json for F5 debugging
When building inside Visual Studio for the first time, the SDK now generates Properties/launchSettings.json with a profile that launches devenv.exe with /rootSuffix Exp. This enables F5 debugging out of the box without any manual configuration.
1 parent f1c4a69 commit ed43989

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

src/CodingWithCalvin.VsixSdk/Sdk/Sdk.Vsix.targets

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,35 @@
205205
Text="No .vsixmanifest file found. VSIX projects require a manifest file." />
206206
</Target>
207207

208+
<!--
209+
Generate launchSettings.json for F5 debugging
210+
Only runs when building inside Visual Studio and the file doesn't exist
211+
This configures VS to launch devenv.exe with the experimental instance
212+
-->
213+
<Target Name="GenerateLaunchSettings"
214+
BeforeTargets="BeforeBuild"
215+
Condition="'$(BuildingInsideVisualStudio)' == 'true' and '$(DevEnvDir)' != '' and !Exists('$(MSBuildProjectDirectory)\Properties\launchSettings.json')">
216+
217+
<PropertyGroup>
218+
<_LaunchSettingsContent><![CDATA[{
219+
"profiles": {
220+
"Start Experimental Instance": {
221+
"commandName": "Executable",
222+
"executablePath": "$(DevEnvDir)devenv.exe",
223+
"commandLineArgs": "/rootSuffix Exp"
224+
}
225+
}
226+
}]]></_LaunchSettingsContent>
227+
</PropertyGroup>
228+
229+
<MakeDir Directories="$(MSBuildProjectDirectory)\Properties" Condition="!Exists('$(MSBuildProjectDirectory)\Properties')" />
230+
<WriteLinesToFile File="$(MSBuildProjectDirectory)\Properties\launchSettings.json"
231+
Lines="$(_LaunchSettingsContent)"
232+
Overwrite="true" />
233+
234+
<Message Importance="high" Text="Generated Properties/launchSettings.json for F5 debugging" />
235+
</Target>
236+
208237
<!--
209238
Import VSSDK targets if available
210239
This is the key integration point with Microsoft.VSSDK.BuildTools

0 commit comments

Comments
 (0)