Skip to content

Commit be3b22e

Browse files
kzujeffkl
authored andcommitted
Allow loading .msbuildproj in VS using NoTargets (#98)
By including the design-time targets and imports expected by CPS, we allow the full loading and editing experience in the IDE automatically. Fixes #97
1 parent c198a74 commit be3b22e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/NoTargets/Sdk/Sdk.props

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" Condition=" '$(MicrosoftCommonPropsHasBeenImported)' != 'true' "/>
1616

1717
<Import Project="$(CustomAfterNoTargetsProps)" Condition=" '$(CustomAfterNoTargetsProps)' != '' And Exists('$(CustomAfterNoTargetsProps)') " />
18-
</Project>
18+
19+
<!-- For CPS/VS support. Importing in .props allows any subsequent targets to redefine this if needed -->
20+
<Target Name="CompileDesignTime" />
21+
22+
</Project>

src/NoTargets/Sdk/Sdk.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,10 @@
4343
</CoreBuildDependsOn>
4444
</PropertyGroup>
4545

46+
<!-- 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 -->
47+
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets"
48+
Condition="'$(DebuggerFlavor)' == '' And Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets')" />
49+
4650
<Import Project="$(CustomAfterNoTargets)" Condition="'$(CustomAfterNoTargets)' != '' and Exists('$(CustomAfterNoTargets)')" />
51+
4752
</Project>

0 commit comments

Comments
 (0)