Skip to content

Commit 5cc494e

Browse files
author
Andrew Hall
committed
Package the extension into a nupkg
1 parent 5bce5e4 commit 5cc494e

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

src/Razor/src/Microsoft.VisualStudioCode.RazorExtension/Microsoft.VisualStudioCode.RazorExtension.csproj

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@
44
<TargetFramework>$(NetVSCode)</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<IsShippingPackage>true</IsShippingPackage>
78

8-
<!-- Ensure we run our custom target, below, to copy compiler project references -->
9-
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
9+
<!--
10+
Build a nuget package for this project. This is not consumed as a standard NuGet package; it just
11+
contains the extension binaries to be packaged in the VS Code VSIX.
12+
-->
13+
<IsPackable>true</IsPackable>
14+
15+
<!-- This is not a standard nuget package and only consumed by the extension build. We don't care if the folder structure doesn't match what nuget expects. -->
16+
<NoWarn>$(NoWarn);NU5100</NoWarn>
17+
18+
<BeforePack>PackPublishContent;$(BeforePack)</BeforePack>
1019
</PropertyGroup>
11-
<ItemGroup>
12-
<Compile Remove="S:\razor\src\Shared\files\LanguageSupport\IsExternalInit.cs" />
13-
</ItemGroup>
1420

1521
<ItemGroup>
22+
<!-- Below package references are covered by the binaries shipped by roslyn and do not need to be packaged-->
1623
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
1724
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" />
1825
<PackageReference Include="Microsoft.Extensions.ObjectPool" />
1926
<PackageReference Include="Microsoft.Extensions.Logging" />
2027
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.Razor.Features" />
28+
29+
<!-- Roslyn does not use Microsoft.VisualStudio.LanguageServer.Protocol so we have to pack it -->
2130
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" GeneratePathProperty="True" />
2231
</ItemGroup>
2332

@@ -31,24 +40,29 @@
3140
<InternalsVisibleTo Include="Microsoft.VisualStudioCode.RazorExtension.Test" Key="$(RazorKey)" />
3241
</ItemGroup>
3342

34-
<ItemGroup>
35-
<Content Include="$(PkgMicrosoft_VisualStudio_LanguageServer_Protocol)\lib\netstandard2.0\Microsoft.VisualStudio.LanguageServer.Protocol.dll" Pack="true" PackagePath="content" CopyToOutputDirectory="PreserveNewest" />
36-
</ItemGroup>
37-
38-
<!--
39-
Include the build output of project references in the package created. We need to do this because the compiler packages
40-
are published via a separate process to tooling, so anything that references this package will try to transitively pull
41-
in the compiler packages, but will be unable to find packages with the same version.
42-
43-
This means we end up with the package for this project including the following additional DLLs:
44-
* Microsoft.CodeAnalysis.Razor.Compiler.dll
45-
* Microsoft.AspNetCore.Razor.Utilities.Shared.dll
46-
47-
(and Microsoft.VisualStudioCode.RazorExtension.dll obviously)
48-
-->
49-
<Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
43+
<Target Name="PackPublishContent" DependsOnTargets="Publish">
5044
<ItemGroup>
51-
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
45+
<Content Include="$(PkgMicrosoft_VisualStudio_LanguageServer_Protocol)\lib\netstandard2.0\Microsoft.VisualStudio.LanguageServer.Protocol.dll" Pack="true" PackagePath="content" CopyToOutputDirectory="PreserveNewest" />
46+
<Content Include="$(TargetPath)" Pack="true" PackagePath="content" CopyToOutputDirectory="PreserveNewest" />
47+
48+
<Content Include="$(PublishDir)\Microsoft.AspNetCore.Razor.Utilities.Shared.dll" Pack="true" PackagePath="content" CopyToOutputDirectory="PreserveNewest" />
49+
<Content Include="$(PublishDir)\Microsoft.CodeAnalysis.Razor.Compiler.dll" Pack="true" PackagePath="content" CopyToOutputDirectory="PreserveNewest" />
50+
<Content Include="$(PublishDir)\Microsoft.CodeAnalysis.Razor.Workspaces.dll" Pack="true" PackagePath="content" CopyToOutputDirectory="PreserveNewest" />
51+
52+
<!-- We don't need to include everything in the bin folder but we do need to add localization resources for the compiler dll -->
53+
<Content Include="$(PublishDir)\cs\**\*.*" Pack="true" PackagePath="content\cs\" CopyToOutputDirectory="PreserveNewest" />
54+
<Content Include="$(PublishDir)\de\**\*.*" Pack="true" PackagePath="content\de\" CopyToOutputDirectory="PreserveNewest" />
55+
<Content Include="$(PublishDir)\es\**\*.*" Pack="true" PackagePath="content\es\" CopyToOutputDirectory="PreserveNewest" />
56+
<Content Include="$(PublishDir)\fr\**\*.*" Pack="true" PackagePath="content\fr\" CopyToOutputDirectory="PreserveNewest" />
57+
<Content Include="$(PublishDir)\it\**\*.*" Pack="true" PackagePath="content\it\" CopyToOutputDirectory="PreserveNewest" />
58+
<Content Include="$(PublishDir)\ja\**\*.*" Pack="true" PackagePath="content\ja\" CopyToOutputDirectory="PreserveNewest" />
59+
<Content Include="$(PublishDir)\ko\**\*.*" Pack="true" PackagePath="content\ko\" CopyToOutputDirectory="false" />
60+
<Content Include="$(PublishDir)\pl\**\*.*" Pack="true" PackagePath="content\pl\" CopyToOutputDirectory="false" />
61+
<Content Include="$(PublishDir)\pt-BR\**\*.*" Pack="true" PackagePath="content\pt-BR\" CopyToOutputDirectory="false" />
62+
<Content Include="$(PublishDir)\ru\**\*.*" Pack="true" PackagePath="content\ru\" CopyToOutputDirectory="false" />
63+
<Content Include="$(PublishDir)\tr\**\*.*" Pack="true" PackagePath="content\tr\" CopyToOutputDirectory="false" />
64+
<Content Include="$(PublishDir)\zh-Hans\**\*.*" Pack="true" PackagePath="content\zh-Hans\" CopyToOutputDirectory="false" />
65+
<Content Include="$(PublishDir)\zh-Hant\**\*.*" Pack="true" PackagePath="content\zh-Hant\" CopyToOutputDirectory="false" />
5266
</ItemGroup>
5367
</Target>
5468
</Project>

0 commit comments

Comments
 (0)