Skip to content

Commit

Permalink
Allow loading .msbuildproj in VS using Traversal SDK (#211)
Browse files Browse the repository at this point in the history
By including the design-time targets and imports expected by CPS, we
allow the full loading and editing experience in the IDE automatically.

Fixes #206
  • Loading branch information
kzu authored Oct 8, 2020
1 parent 091000d commit 5933d25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Traversal/Sdk/Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemDefinitionGroup>

<!-- For CPS/VS support. Importing in .props allows any subsequent targets to redefine this if needed -->
<Target Name="CompileDesignTime" />

<Import Project="$(CustomAfterTraversalProps)" Condition=" '$(CustomAfterTraversalProps)' != '' And Exists('$(CustomAfterTraversalProps)') " />
</Project>
4 changes: 4 additions & 0 deletions src/Traversal/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,9 @@
-->
<Target Name="_CheckForInvalidConfigurationAndPlatform" />

<!-- For CPS/VS support. See https://github.com/dotnet/project-system/blob/master/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/DesignTimeTargets/Microsoft.Managed.DesignTime.targets#L60 -->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets"
Condition="'$(DebuggerFlavor)' == '' And Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets')" />

<Import Project="$(CustomAfterTraversalTargets)" Condition=" '$(CustomAfterTraversalTargets)' != '' And Exists('$(CustomAfterTraversalTargets)') " />
</Project>

0 comments on commit 5933d25

Please sign in to comment.