Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 116d57c

Browse files
williamb1024kzu
authored andcommitted
Defined ProjectCapability ItemGroup when building outside of Visual Studio. (#136)
* Copied ProjectCapability ItemGroup from src/VisualStudio/NuGet.Packaging.VisualStudio/Targets/NuGet.Packaging.Authoring.targets to Build/NuGet.Packaging.Authoring.targets * Modify Scenario.targets to prevent Microsoft.CSharp.targets from being included in all tests.
1 parent 4cbd8f8 commit 116d57c

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Authoring.targets

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,37 @@ Copyright (c) .NET Foundation. All rights reserved.
3333
</ProjectReference>
3434
</ItemDefinitionGroup>
3535

36+
<!-- ProjectCapabilities in dev15 should be supported via NuGet packages -->
37+
<ItemGroup>
38+
<ProjectCapability Include="PackagingProject" />
39+
40+
<!-- Allows configurations inferred from Condition="CONFIG|PLATFORM" usage -->
41+
<ProjectCapability Include="ProjectConfigurationsInferredFromUsage" />
42+
43+
<!-- DependenciesTree capability lights up a Dependencies tree node and it's sub node providers-->
44+
<ProjectCapability Include="DependenciesTree" />
45+
46+
<ProjectCapability Include="
47+
AssemblyReferences;
48+
ProjectReferences;
49+
PackageReferences;
50+
OutputGroups;
51+
AllTargetOutputGroups;
52+
VisualStudioWellKnownOutputGroups;
53+
SingleFileGenerators;
54+
DeclaredSourceItems;
55+
UserSourceItems" />
56+
57+
<!-- Reference Manager capabilities -->
58+
<ProjectCapability Include="ReferenceManagerAssemblies" />
59+
<ProjectCapability Include="ReferenceManagerBrowse" />
60+
<ProjectCapability Include="ReferenceManagerProjects" />
61+
62+
</ItemGroup>
63+
3664
<!-- Just to make it easy for consumers to request the TargetPath as usual but get the
3765
actual package file, which contains the PackageVersion and will be dynamic therefore. -->
38-
<Target Name="UpdateTargetPath"
66+
<Target Name="UpdateTargetPath"
3967
BeforeTargets="GetTargetPath"
4068
DependsOnTargets="GetPackageTargetPath">
4169
<PropertyGroup>
@@ -46,11 +74,11 @@ Copyright (c) .NET Foundation. All rights reserved.
4674
<Target Name="CoreCompile" DependsOnTargets="Pack" />
4775
<Target Name="CreateManifestResourceNames" />
4876
<Target Name="GetReferenceAssemblyPaths" />
49-
77+
5078
<Target Name="_CleanReferences" AfterTargets="ResolveAssemblyReferences">
5179
<ItemGroup>
5280
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" />
5381
</ItemGroup>
5482
</Target>
55-
83+
5684
</Project>

src/Build/NuGet.Build.Packaging.Tests/Scenarios/Scenario.targets

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
<DocumentationFile Condition="'$(DocumentationFile)' == ''">$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
55
</PropertyGroup>
66

7-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition="'$(IsPortable)' != 'true'" />
7+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition="'$(IsPortable)' != 'true' and '$(MSBuildProjectExtension)' == '.csproj'" />
88
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets"
9-
Condition="'$(IsPortable)' == 'true'" />
10-
<!-- Ensure we get proper NuGet behavior always -->
9+
Condition="'$(IsPortable)' == 'true' and '$(MSBuildProjectExtension)' == '.csproj'" />
10+
11+
<!-- Ensure we get proper NuGet behavior always -->
1112
<Import Project="$(NuGetRestoreTargets)" Condition="'$(IsRestoreTargetsFileLoaded)' != 'true' and '$(NuGetRestoreTargets)' != ''" />
1213
<Import Project="$(NuGetTargets)" Condition="'$(ResolveNuGetPackageAssetsDependsOn)' == '' and '$(NuGetTargets)' != ''" />
1314

@@ -95,5 +96,7 @@
9596
</Code>
9697
</Task>
9798
</UsingTask>
98-
99+
100+
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
101+
99102
</Project>

0 commit comments

Comments
 (0)