Skip to content

Commit e36948f

Browse files
authored
Glob include files based on project extension (VS) (dotnet#46702)
* Glob include files based on project extension (VS) * Update Directory.Build.targets * Update Directory.Build.targets * Update Directory.Build.targets
1 parent 32a9a04 commit e36948f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Directory.Build.targets

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
<InformationalVersion Condition="'$(InformationalVersion)' == '' and '$(VersionSuffix)' == ''">$(ProductVersion)</InformationalVersion>
2525
<InformationalVersion Condition="'$(InformationalVersion)' == '' and '$(VersionSuffix)' != ''">$(ProductVersion)-$(VersionSuffix)</InformationalVersion>
2626
</PropertyGroup>
27+
28+
<!-- The Default behavior in VS is to show files for the first target framework in TargetFrameworks property.
29+
This is required to show all the files corresponding to all target frameworks in VS. -->
30+
<ItemGroup Condition="'$(DefaultLanguageSourceExtension)' != '' and
31+
('$(BuildingInsideVisualStudio)' == 'true' or '$(DesignTimeBuild)' == 'true')">
32+
<None Include="$(MSBuildProjectDirectory)\**\*$(DefaultLanguageSourceExtension)"
33+
Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);@(Compile)" />
34+
</ItemGroup>
2735

2836
<!-- Packaging -->
2937
<ItemGroup Condition="'$(IsPackable)' == 'true'">
@@ -62,4 +70,4 @@
6270
<PackDependsOn />
6371
</PropertyGroup>
6472
</Target>
65-
</Project>
73+
</Project>

src/libraries/Directory.Build.targets

-7
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,6 @@
256256
</When>
257257
</Choose>
258258

259-
<!-- The Default behavior in VS is to show files for the first target framework in TargetFrameworks property.
260-
This is required to show all the files corresponding to all target frameworks in VS. -->
261-
<ItemGroup Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(DesignTimeBuild)' == 'true'">
262-
<None Include="$(MSBuildProjectDirectory)\**\*.cs"
263-
Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);@(Compile)" />
264-
</ItemGroup>
265-
266259
<PropertyGroup>
267260
<SkipLocalsInit Condition="'$(SkipLocalsInit)' == '' and '$(MSBuildProjectExtension)' == '.csproj' and '$(IsNETCoreAppSrc)' == 'true' and ($([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetCoreAppCurrent)')))">true</SkipLocalsInit>
268261
</PropertyGroup>

0 commit comments

Comments
 (0)