Skip to content

Automatically set 'PrivateAssets=All' for .Sources references #7539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions eng/targets/ResolveReferences.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@
<UseProjectReferences Condition=" '$(UseProjectReferences)' == '' ">false</UseProjectReferences>
</PropertyGroup>

<ItemDefinitionGroup>
<Reference>
<IsSharedSource></IsSharedSource>
</Reference>
</ItemDefinitionGroup>

<ItemGroup>
<Reference Update="@(Reference)">
<IsSharedSource Condition="'%(IsSharedSource)' == '' AND $([System.String]::new('%(Identity)').EndsWith('.Sources'))">true</IsSharedSource>
</Reference>

<!-- Packages which are implicitly defined by the .NET Core SDK. -->
<_ImplicitPackageReference Include="@(PackageReference->WithMetadataValue('IsImplicitlyDefined', 'true'))" />
<!-- Capture a list of references which were set explicitly in the project. -->
Expand All @@ -67,7 +77,8 @@
@(AspNetCoreAppReference);
@(AspNetCoreAppReferenceAndPackage);
@(ExternalAspNetCoreAppReference);
@(_CompilationOnlyReference)" />
@(_CompilationOnlyReference);
@(Reference->WithMetadataValue('IsSharedSource', 'true'))" />
<!-- TODO: remove Newtonsoft.Json from this list once https://github.com/aspnet/AspNetCore/issues/4260 is resolved -->

<!--
Expand All @@ -87,12 +98,6 @@
<Reference Remove="@(Reference)" />
</ItemGroup>

<ItemDefinitionGroup>
<Reference>
<SharedSources>false</SharedSources>
</Reference>
</ItemDefinitionGroup>

<!--
This target resolves remaining Referene items to Packages, if possible. If not, they are left as Reference items fo the SDK to resolve.
This target helps ensure projects within the shared framework do no unintentionally add new references,
Expand All @@ -104,7 +109,7 @@
<Error Condition="@(_InvalidReferenceToSharedFxOnlyAssembly->Count()) != 0"
Text="Cannot reference &quot;%(_InvalidReferenceToSharedFxOnlyAssembly.Identity)&quot; directly because it is part of the shared framework and this project is not. Use &lt;FrameworkReference Include=&quot;Microsoft.AspNetCore.App&quot; /&gt; instead." />

<Error Condition="@(_InvalidReferenceToNonSharedFxAssembly->Count()) != 0 AND '%(_InvalidReferenceToNonSharedFxAssembly.SharedSources)' != 'true'"
<Error Condition="@(_InvalidReferenceToNonSharedFxAssembly->Count()) != 0"
Text="Cannot reference &quot;%(_InvalidReferenceToNonSharedFxAssembly.Identity)&quot;. This dependency is not in the shared framework. See docs/SharedFramework.md for instructions on how to modify what is in the shared framework." />
</Target>

Expand All @@ -119,8 +124,8 @@

<!-- Ensure only content asset are consumed from .Sources packages -->
<Reference>
<IncludeAssets Condition="'%(SharedSources)' == 'true'">ContentFiles</IncludeAssets>
<PrivateAssets Condition="'%(SharedSources)' == 'true'">All</PrivateAssets>
<IncludeAssets Condition="'%(IsSharedSource)' == 'true'">ContentFiles</IncludeAssets>
<PrivateAssets Condition="'%(IsSharedSource)' == 'true'">All</PrivateAssets>
</Reference>

<!-- Identify if any references were present in the last release of this package, but have been removed. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<ItemGroup>
<ProjectReference Condition="'$(BuildNodeJS)' != 'false'" Include="$(RepositoryRoot)src\Components\Browser.JS\src\Microsoft.AspNetCore.Components.Browser.JS.npmproj" ReferenceOutputAssembly="false" />
<Reference Include="Microsoft.AspNetCore.Components" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
<Reference Include="Microsoft.Extensions.FileProviders.Composite" />
<Reference Include="Microsoft.Extensions.FileProviders.Physical" />
<Reference Include="Mono.Cecil" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Reference Include="Microsoft.AspNetCore.Components.Server" />
<Reference Include="Microsoft.AspNetCore.ResponseCompression" />
<Reference Include="Microsoft.AspNetCore" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
</ItemGroup>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<Reference Include="BenchmarkDotNet" />
<Reference Include="Microsoft.AspNetCore.Components" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Reference Include="Microsoft.Extensions.Hosting.Abstractions" />
<Reference Include="Microsoft.Extensions.Logging" />
<Reference Include="Microsoft.Extensions.Options" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.Extensions.HostFactoryResolver.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.HostFactoryResolver.Sources" />
<Reference Include="System.IO.Pipelines" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Microsoft.AspNetCore.Http.HttpResponse</Description>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Features" />
<Reference Include="Microsoft.Extensions.ActivatorUtilities.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.ActivatorUtilities.Sources" />
<Reference Include="System.Text.Encodings.Web" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<Reference Include="BenchmarkDotNet" />
<Reference Include="Microsoft.AspNetCore.Http" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<ItemGroup>
<Reference Include="BenchmarkDotNet" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" />
<Reference Include="Microsoft.AspNetCore.Http" />
<Reference Include="Microsoft.AspNetCore.Routing" />
<Reference Include="Microsoft.Extensions.DependencyInjection" />
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Microsoft.AspNetCore.Routing.RouteCollection</Description>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Extensions" />
<Reference Include="Microsoft.AspNetCore.Routing.Abstractions" />
<Reference Include="Microsoft.Extensions.HashCodeCombiner.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.HashCodeCombiner.Sources" />
<Reference Include="Microsoft.Extensions.Logging.Abstractions" />
<Reference Include="Microsoft.Extensions.ObjectPool" />
<Reference Include="Microsoft.Extensions.Options" />
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Routing/tools/Swaggatherer/Swaggatherer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<Reference Include="Newtonsoft.Json" />
<Reference Include="Microsoft.AspNetCore.Routing" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Reference Include="Microsoft.Extensions.FileProviders.Physical" />
<Reference Include="Microsoft.Extensions.Logging.Abstractions" />
<Reference Include="Microsoft.Extensions.Options" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<Reference Include="BenchmarkDotNet" />
<Reference Include="Microsoft.AspNetCore.Http" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" />
<Reference Include="Microsoft.AspNetCore.ResponseCompression" />
<Reference Include="Microsoft.Extensions.DependencyInjection" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Microsoft.AspNetCore.Mvc.IActionResult</Description>
</ItemGroup>

<ItemGroup Label="Sources packages">
<Reference Include="Microsoft.Extensions.HashCodeCombiner.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.HashCodeCombiner.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Microsoft.AspNetCore.Mvc.RouteAttribute</Description>
</ItemGroup>

<ItemGroup Label="Sources packages">
<Reference Include="Microsoft.Extensions.ParameterDefaultValue.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.ParameterDefaultValue.Sources" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.TestHost" />
<Reference Include="Microsoft.AspNetCore.Mvc.Core" />
<Reference Include="Microsoft.Extensions.HostFactoryResolver.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.HostFactoryResolver.Sources" />
<Reference Include="Microsoft.Extensions.Hosting" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/ProjectTemplates/test/ProjectTemplates.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<ItemGroup>
<Reference Include="AngleSharp" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
<Reference Include="Selenium.Support" />
<Reference Include="Selenium.WebDriver.MicrosoftDriver" />
<Reference Include="Selenium.WebDriver" />
Expand Down
2 changes: 1 addition & 1 deletion src/Razor/Razor/src/Microsoft.AspNetCore.Razor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper</Description>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Html.Abstractions" />
<Reference Include="Microsoft.Extensions.HashCodeCombiner.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.HashCodeCombiner.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Authorization.Policy" />
<Reference Include="BenchmarkDotNet" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" />
<Reference Include="Microsoft.AspNetCore.Http" />
<Reference Include="Microsoft.Extensions.DependencyInjection" />
<Reference Include="Microsoft.Extensions.Logging" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Features" />
<Reference Include="Microsoft.Extensions.ActivatorUtilities.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.ActivatorUtilities.Sources" />
<Reference Include="System.IO.Pipelines" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<ItemGroup>
<Reference Include="BenchmarkDotNet" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<Compile Include="$(KestrelSharedSourceRoot)test\TestHttp1Connection.cs" />
<Compile Include="$(KestrelSharedSourceRoot)test\TestKestrelTrace.cs" />
</ItemGroup>

<ItemGroup>
<Reference Include="BenchmarkDotNet" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Core" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Abstractions" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" />
<Reference Include="Newtonsoft.Json" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Reference Include="FSharp.Core" />
<Reference Include="System.Reflection.Metadata" />
<Reference Include="System.Threading.Tasks.Extensions" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.TypeNameHelper.Sources" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'" >
<Reference Include="Microsoft.Bcl.Json.Sources" SharedSources="true" />
<Reference Include="Microsoft.Bcl.Json.Sources" />
<Reference Include="System.Buffers" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Reference Include="Microsoft.AspNetCore.Http" />
<Reference Include="Microsoft.AspNetCore.Routing" />
<Reference Include="Microsoft.AspNetCore.WebSockets" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" SharedSources="true" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" />
<Reference Include="Newtonsoft.Json" />
<Reference Include="System.Security.Principal.Windows" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Reference Include="Microsoft.Bcl.Json.Sources" SharedSources="true" />
<Reference Include="Microsoft.Bcl.Json.Sources" />
<Reference Include="System.Buffers" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Reference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" />
<Reference Include="Microsoft.AspNetCore.Testing" />
<Reference Include="Microsoft.Extensions.Logging.Testing" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Reference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" />
<Reference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" />
<Reference Include="Microsoft.Extensions.DependencyInjection" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.ValueStopwatch.Sources" />
<Reference Include="Moq" />
<Reference Include="System.Reactive.Linq" />
<Reference Include="System.Threading.Channels" />
Expand Down
2 changes: 1 addition & 1 deletion src/SignalR/perf/benchmarkapps/Crankier/Crankier.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.SignalR.Client" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
<Reference Include="Newtonsoft.Json" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/SignalR/samples/ClientSample/ClientSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Reference Include="Microsoft.AspNetCore.SignalR.Client" />
<Reference Include="Microsoft.Extensions.Logging.Console" />
<Reference Include="Microsoft.Extensions.Logging" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Tools/dotnet-dev-certs/src/dotnet-dev-certs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
<Reference Include="System.Security.Cryptography.Cng" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
<Reference Include="System.Data.SqlClient" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
<Reference Include="Microsoft.Extensions.Configuration.UserSecrets" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Tools/dotnet-watch/src/dotnet-watch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
</ItemGroup>

</Project>