Skip to content

Commit 7daa0e0

Browse files
authored
Convert BlazorExtension to SDK style project (#7588)
* Convert BlazorExtension to SDK style project Fixes #7135
1 parent fe1c2c8 commit 7daa0e0

File tree

2 files changed

+55
-176
lines changed

2 files changed

+55
-176
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" />
3+
4+
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
5+
</Project>
Lines changed: 50 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
4-
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
3+
<TargetFramework>net472</TargetFramework>
4+
5+
<!-- Use the same experimental hive as Roslyn and Razor. This makes it easy to mix private builds. -->
6+
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
7+
8+
<!-- Required to run the project localy -->
9+
<StartAction>Program</StartAction>
10+
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
11+
<StartArguments>/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log</StartArguments>
12+
13+
<!--
14+
Mark the VSIX as a per-computer install (not-per-user). Putting a component "in the box"
15+
requires this, and trying to change it after doing a release has lot of problems.
16+
-->
17+
<ExtensionInstallationRoot>CommonExtensions</ExtensionInstallationRoot>
18+
<ExtensionInstallationFolder>Microsoft\Blazor</ExtensionInstallationFolder>
19+
20+
<!-- This should be set as true if we're ever building the VSIX for inclusion by the VS installer. -->
21+
<IsProductComponent Condition="'$(IsProductComponent)'==''">false</IsProductComponent>
22+
23+
<!-- Update the VSToolsPath to ensure VSIX builds -->
524
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6-
<UseCodebase>true</UseCodebase>
7-
<ImportDirectoryBuildProps>true</ImportDirectoryBuildProps>
8-
<ImportDirectoryBuildTargets>true</ImportDirectoryBuildTargets>
9-
<OutputPath>bin\$(Configuration)\</OutputPath>
10-
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
1125
<!-- Other projects should not reference this assembly. It is only meaning to be used in Visual Studio. -->
1226
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
13-
<IsShippingPackage>false</IsShippingPackage>
27+
1428
<IsPackable>false</IsPackable>
15-
<EnableSourceLink>false</EnableSourceLink>
16-
<GenerateSourceLinkFile>false</GenerateSourceLinkFile>
29+
<UseCodebase>true</UseCodebase>
30+
<GeneratePkgDefFile>true</GeneratePkgDefFile>
1731
<DeployExtension Condition="'$(CI)' == 'true'">false</DeployExtension>
1832
<DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions>
1933
</PropertyGroup>
20-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
2134

2235
<!--
2336
Since the VSSDK doeesn't support SDK-based projects, we have to use the long/verbose version.
@@ -38,6 +51,8 @@
3851
<VsixVersionSuffix Condition="'$(BuildNumberSuffix)'=='t000'">424242.424242</VsixVersionSuffix>
3952
<VsixVersionSuffix Condition="'$(VsixVersionSuffix)'==''">$(BuildNumberSuffix.Replace('-', '.'))</VsixVersionSuffix>
4053
<VsixVersion>$(VsixVersionPrefix).$(VsixVersionSuffix)</VsixVersion>
54+
55+
<InformationalVersion>$(VsixVersion)</InformationalVersion>
4156
</PropertyGroup>
4257

4358
<PropertyGroup>
@@ -50,23 +65,6 @@
5065
-->
5166
<Target Name="GetBuildVersion" Outputs="$(VsixVersion)" />
5267

53-
<PropertyGroup>
54-
<!-- Use the same experimental hive as Roslyn and Razor. This makes it easy to mix private builds. -->
55-
<StartAction>Program</StartAction>
56-
<StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
57-
<StartArguments>/rootsuffix RoslynDev</StartArguments>
58-
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
59-
</PropertyGroup>
60-
<PropertyGroup>
61-
<!--
62-
Mark the VSIX as a per-computer install (not-per-user). Putting a component "in the box"
63-
requires this, and trying to change it after doing a release has lot of problems.
64-
-->
65-
<ExtensionInstallationRoot>CommonExtensions</ExtensionInstallationRoot>
66-
<ExtensionInstallationFolder>Microsoft\Blazor</ExtensionInstallationFolder>
67-
<!-- This should be set as true if we're ever building the VSIX for inclusion by the VS installer. -->
68-
<IsProductComponent Condition="'$(IsProductComponent)'==''">false</IsProductComponent>
69-
</PropertyGroup>
7068
<PropertyGroup>
7169
<!--
7270
Include this assembly in the VSIX but not its symbols, except when installing it to the experimental
@@ -101,174 +99,50 @@
10199
</Target>
102100

103101
<ItemGroup>
104-
<!--
105-
Let's continue our parade of gross workarounds.
102+
<Content Include="CodeSnippets.pkgdef" CopyToOutputDirectory="PreserveNewest" IncludeInVSIX="true" />
103+
<Content Include="Templates.pkgdef" />
104+
<Content Include="CodeSnippets\Blazor\para.snippet" CopyToOutputDirectory="PreserveNewest" IncludeInVSIX="true" />
105+
<Content Include="Content\WebConfiguration.png" CopyToOutputDirectory="PreserveNewest" IncludeInVSIX="true" />
106+
<Content Include="Resources\BlazorPackage.ico" CopyToOutputDirectory="PreserveNewest" IncludeInVSIX="true" />
106107

107-
Referencing a cross-targeting project using a P2P from a VSIX project doesn't work well. To work around
108-
this problem, we're only using the P2P references to force build ordering. Then we include the build
109-
output of those projects as content.
110-
-->
111-
<Content Include="CodeSnippets.pkgdef">
112-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
113-
<IncludeInVSIX>true</IncludeInVSIX>
108+
<Content Include="..\..\..\THIRD-PARTY-NOTICES.txt" CopyToOutputDirectory="PreserveNewest" IncludeInVSIX="true">
109+
<Link>Content\THIRD-PARTY-NOTICES.txt</Link>
114110
</Content>
115-
<Content Include="Templates.pkgdef" />
116-
<ProjectReference Include="..\..\Templates\src\Microsoft.AspNetCore.Blazor.Templates.csproj">
117-
<Project>{edd21533-c6e6-4f85-be4f-10e06756e24c}</Project>
118-
<Name>Microsoft.AspNetCore.Blazor.Templates</Name>
119-
<Targets>Pack</Targets>
120-
<Private>False</Private>
121-
<IncludeOutputGroupsInVSIX>
122-
</IncludeOutputGroupsInVSIX>
123-
<IncludeOutputGroupsInVSIXLocalOnly>
124-
</IncludeOutputGroupsInVSIXLocalOnly>
125-
</ProjectReference>
111+
<Content Include="$(RepositoryRoot)LICENSE.txt" CopyToOutputDirectory="PreserveNewest" IncludeInVSIX="true">
112+
<Link>Content\LICENSE.txt</Link>
113+
</Content>
114+
115+
<None Include="source.extension.vsixmanifest" SubType="Designer" />
126116
</ItemGroup>
127-
<!--
128-
We need to generate the assembly attributes for our assembly using the version from the build, so
129-
we can flow it to the about dialog.
130-
-->
117+
131118
<ItemGroup>
132-
<_VSIXAssemblyAttribute Include="System.Reflection.AssemblyInformationalVersionAttribute">
133-
<_Parameter1>$(VersionPrefix)-$(VersionSuffix)</_Parameter1>
134-
</_VSIXAssemblyAttribute>
119+
<ProjectReference Include="..\..\Templates\src\Microsoft.AspNetCore.Blazor.Templates.csproj" />
135120
</ItemGroup>
136-
<Target Name="_GenerateVSIXAssemblyAttributesHash" DependsOnTargets="PrepareForBuild" Condition="'@(_VSIXAssemblyAttribute)' != ''">
137-
<!-- We only use up to _Parameter1 for most attributes, but other targets may add additional assembly attributes with multiple parameters. -->
138-
<Hash ItemsToHash="@(_VSIXAssemblyAttribute->'%(Identity)%(_Parameter1)%(_Parameter2)%(_Parameter3)%(_Parameter4)%(_Parameter5)%(_Parameter6)%(_Parameter7)%(_Parameter8)')">
139-
<Output TaskParameter="HashResult" PropertyName="_VSIXAssemblyAttributesHash" />
140-
</Hash>
141-
<WriteLinesToFile Lines="$(_VSIXAssemblyAttributesHash)" File="$(_GeneratedVSIXAssemblyInfoInputsCacheFile)" Overwrite="True" WriteOnlyWhenDifferent="True" />
142-
<ItemGroup>
143-
<FileWrites Include="$(_GeneratedVSIXAssemblyInfoInputsCacheFile)" />
144-
</ItemGroup>
145-
</Target>
146-
<Target Name="_GenerateVSIXAssemblyAttributes" DependsOnTargets="_GenerateVSIXAssemblyAttributesHash" Inputs="$(_GeneratedVSIXAssemblyInfoInputsCacheFile)" Outputs="$(_GeneratedVSIXAssemblyInfoFile)" BeforeTargets="CoreCompile">
147-
<ItemGroup>
148-
<Compile Include="$(_GeneratedVSIXAssemblyInfoFile)">
149-
<Visible>false</Visible>
150-
</Compile>
151-
</ItemGroup>
152-
<WriteCodeFragment AssemblyAttributes="@(_VSIXAssemblyAttribute)" Language="C#" OutputFile="$(_GeneratedVSIXAssemblyInfoFile)" />
153-
<ItemGroup>
154-
<FileWrites Include="$(_GeneratedVSIXAssemblyInfoFile)" />
155-
</ItemGroup>
156-
</Target>
157-
<!--
158-
159-
END INTERESTING STUFF
160121

161-
-->
162-
<PropertyGroup>
163-
<SchemaVersion>2.0</SchemaVersion>
164-
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
165-
<ProjectGuid>{9088E4E4-B855-457F-AE9E-D86709A5E1F4}</ProjectGuid>
166-
<OutputType>Library</OutputType>
167-
<AppDesignerFolder>Properties</AppDesignerFolder>
168-
<RootNamespace>Microsoft.VisualStudio.BlazorExtension</RootNamespace>
169-
<AssemblyName>Microsoft.VisualStudio.BlazorExtension</AssemblyName>
170-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
171-
<GeneratePkgDefFile>true</GeneratePkgDefFile>
172-
</PropertyGroup>
173-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
174-
<DebugSymbols>true</DebugSymbols>
175-
<DebugType>full</DebugType>
176-
<Optimize>false</Optimize>
177-
<DefineConstants>DEBUG;TRACE</DefineConstants>
178-
<ErrorReport>prompt</ErrorReport>
179-
<WarningLevel>4</WarningLevel>
180-
</PropertyGroup>
181-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
182-
<DebugType>pdbonly</DebugType>
183-
<Optimize>true</Optimize>
184-
<DefineConstants>TRACE</DefineConstants>
185-
<ErrorReport>prompt</ErrorReport>
186-
<WarningLevel>4</WarningLevel>
187-
</PropertyGroup>
188122
<ItemGroup>
189123
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="15.7.27703" />
190124
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="15.9.3032" />
191125
<PackageReference Include="StreamJsonRpc" Version="1.5.43" />
192126
</ItemGroup>
193-
<ItemGroup>
194-
<Compile Include="AboutDialogInfoAttribute.cs" />
195-
<Compile Include="AutoRebuild\AutoRebuildService.cs" />
196-
<Compile Include="AutoRebuild\BuildEventsWatcher.cs" />
197-
<Compile Include="AutoRebuild\StreamProtocolExtensions.cs" />
198-
<Compile Include="BlazorPackage.cs" />
199-
</ItemGroup>
200-
<ItemGroup>
201-
<Content Include="CodeSnippets\Blazor\para.snippet">
202-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
203-
<IncludeInVSIX>true</IncludeInVSIX>
204-
</Content>
205-
<None Include="Key.snk" />
206-
<None Include="source.extension.vsixmanifest">
207-
<SubType>Designer</SubType>
208-
</None>
209-
</ItemGroup>
210-
<ItemGroup>
211-
<Content Include="..\..\..\THIRD-PARTY-NOTICES.txt">
212-
<Link>Content\THIRD-PARTY-NOTICES.txt</Link>
213-
<IncludeInVSIX>true</IncludeInVSIX>
214-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
215-
</Content>
216-
<Content Include="$(RepositoryRoot)LICENSE.txt">
217-
<Link>Content\LICENSE.txt</Link>
218-
<IncludeInVSIX>true</IncludeInVSIX>
219-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
220-
</Content>
221-
<Content Include="Content\WebConfiguration.png">
222-
<IncludeInVSIX>true</IncludeInVSIX>
223-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
224-
</Content>
225-
<Content Include="Resources\BlazorPackage.ico">
226-
<IncludeInVSIX>true</IncludeInVSIX>
227-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
228-
</Content>
229-
</ItemGroup>
127+
128+
<!-- Resources are a little bit special in a VSIX -->
129+
<PropertyGroup>
130+
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
131+
</PropertyGroup>
132+
230133
<ItemGroup>
231134
<EmbeddedResource Include="Resources.resx">
232135
<MergeWithCTO>true</MergeWithCTO>
233136
<ManifestResourceName>VSPackage</ManifestResourceName>
234137
</EmbeddedResource>
235138
</ItemGroup>
139+
236140
<ItemGroup>
237-
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
238-
<EmbedInteropTypes>False</EmbedInteropTypes>
239-
</Reference>
240-
<Reference Include="EnvDTE100, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
241-
<EmbedInteropTypes>False</EmbedInteropTypes>
242-
</Reference>
243-
<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
244-
<EmbedInteropTypes>False</EmbedInteropTypes>
245-
</Reference>
246-
<Reference Include="EnvDTE90, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
247-
<EmbedInteropTypes>False</EmbedInteropTypes>
248-
</Reference>
249-
<Reference Include="Microsoft.CSharp" />
250-
<Reference Include="Microsoft.VisualStudio.CommandBars, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
251-
<EmbedInteropTypes>False</EmbedInteropTypes>
252-
</Reference>
253-
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
254-
<EmbedInteropTypes>False</EmbedInteropTypes>
255-
</Reference>
141+
<Reference Include="PresentationCore" />
142+
<Reference Include="PresentationFramework" />
256143
<Reference Include="System" />
257-
<Reference Include="System.Data" />
258144
<Reference Include="System.Design" />
259145
<Reference Include="System.Drawing" />
260146
<Reference Include="System.Windows.Forms" />
261-
<Reference Include="System.Xml" />
262147
</ItemGroup>
263-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
264-
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
265-
<!-- Must be defined after the CSharp.targets -->
266-
<PropertyGroup>
267-
<_GeneratedVSIXAssemblyInfoInputsCacheFile>$(IntermediateOutputPath)$(MSBuildProjectName).VSIXAssemblyInfo.cache.txt</_GeneratedVSIXAssemblyInfoInputsCacheFile>
268-
<_GeneratedVSIXAssemblyInfoFile>$(IntermediateOutputPath)$(MSBuildProjectName).VSIXAssemblyInfo.cs</_GeneratedVSIXAssemblyInfoFile>
269-
</PropertyGroup>
270-
271-
<!-- This needs to be here because the build will try to call it -->
272-
<Target Name="Pack">
273-
</Target>
274148
</Project>

0 commit comments

Comments
 (0)