Skip to content

Commit

Permalink
Disable implicit transitive references in VSIX projects
Browse files Browse the repository at this point in the history
By default the new SDK will cause projecs to reference the full
transitive closure of project references, not just the direct
references. This is fine in most cases but caused breaks in our VSIX
projects.

Our VSIX projects often reference project with specific extra metadata
to control whether or not their contents are included in the final VSIX.
That extra metadata is not applied to projects which are implicitly
referenced by the new SDK. That caused our VSIX to bloat in size and
have functionally incorrect contents.

Fixed this by disabling implicit transitive references for our VSIX
projects.

dotnet/sdk#1366
  • Loading branch information
jaredpar committed Jun 28, 2017
1 parent d2fbb9e commit 4d69e67
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions build/Targets/DisableTransitiveReferences.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
Defining this target will disable the new SDK behavior of implicit transitive project
references. This is a fine feature in general but the current implementation breaks VSIX
construction by including a number of projects that should not be included.
https://github.com/dotnet/sdk/issues/1366
-->
<Target Name="IncludeTransitiveProjectReferences">

</Target>

</Project>
3 changes: 2 additions & 1 deletion build/Targets/Imports.targets
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
2) The SDK targets don't currently look at the ReferenceCopyLocalPaths produced
by the NuGet build task. -->

<Target Name="IncludeNuGetResolvedAssets" DependsOnTargets="RunResolvePackageDependencies" Condition="'@(NuGetPackageToIncludeInVsix)' != ''">
<Target Name="IncludeNuGetResolvedAssets" DependsOnTargets="ResolvePackageDependenciesForBuild" Condition="'@(NuGetPackageToIncludeInVsix)' != ''">
<ItemGroup>
<_ReferenceCopyLocalPathsWithPotentialInclusions Include="@(ReferenceCopyLocalPaths)">
<NuGetPackageToIncludeInVsix>%(NuGetPackageToIncludeInVsix.Identity)</NuGetPackageToIncludeInVsix>
Expand Down Expand Up @@ -363,6 +363,7 @@

<Import Project="GenerateAssemblyInfo.targets" Condition="'$(ProjectLanguage)' == 'CSharp' OR '$(ProjectLanguage)' == 'VB'" />
<Import Project="GenerateInternalsVisibleTo.targets" />
<Import Project="DisableTransitiveReferences.targets" Condition="'$(RoslynProjectType)' == 'Vsix' AND '$(RoslynSdkProject)' == 'true'" />

<ItemDefinitionGroup>
<VSIXSourceItem>
Expand Down

0 comments on commit 4d69e67

Please sign in to comment.