Skip to content

Commit 67bfa36

Browse files
authored
feat(sdk): add implicit Microsoft.VSSDK.BuildTools package reference (#6)
* feat(sdk): add implicit Microsoft.VSSDK.BuildTools package reference - SDK now automatically includes VSSDK.BuildTools (version 17.* by default) - Users can override version with VssdkBuildToolsVersion property - Update README to remove explicit BuildTools references from examples * 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 97b7677 commit 67bfa36

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ Replace your entire `.csproj` file with the SDK-style format:
105105

106106
<ItemGroup>
107107
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.*" />
108-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.*" PrivateAssets="all" />
109108
</ItemGroup>
110109

111110
</Project>
@@ -138,11 +137,12 @@ Convert from `packages.config` to `PackageReference` format in your `.csproj`:
138137
```xml
139138
<ItemGroup>
140139
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.*" />
141-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.*" PrivateAssets="all" />
142140
<!-- Add other packages your extension uses -->
143141
</ItemGroup>
144142
```
145143

144+
> **Note:** `Microsoft.VSSDK.BuildTools` is automatically included by the SDK.
145+
146146
#### Step 6: Handle VSCT Files
147147

148148
If you have `.vsct` files, they're automatically included. Remove any explicit `<VSCTCompile>` items unless you need custom metadata.
@@ -182,7 +182,6 @@ If you prefer to set up manually, create a `.csproj` file:
182182

183183
<ItemGroup>
184184
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.*" />
185-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.*" PrivateAssets="all" />
186185
</ItemGroup>
187186

188187
</Project>

src/CodingWithCalvin.VsixSdk/Sdk/Sdk.Vsix.props

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
Condition="Exists('$(MSBuildThisFileDirectory)..\analyzers\dotnet\cs\CodingWithCalvin.VsixSdk.Generators.dll')" />
1515
</ItemGroup>
1616

17+
<!--
18+
Implicit package references for VSIX development.
19+
Users can override the version by setting VssdkBuildToolsVersion before SDK import.
20+
-->
21+
<PropertyGroup>
22+
<VssdkBuildToolsVersion Condition="'$(VssdkBuildToolsVersion)' == ''">17.*</VssdkBuildToolsVersion>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="$(VssdkBuildToolsVersion)" PrivateAssets="all" />
27+
</ItemGroup>
28+
1729
<PropertyGroup>
1830
<!-- Identify that this SDK is in use -->
1931
<UsingCodingWithCalvinVsixSdk>true</UsingCodingWithCalvinVsixSdk>

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)