Produce a package with just reference assemblies for AspNetCore.App (#7355)

This commit is contained in:
Nate McMaster 2019-02-07 19:47:52 -08:00 committed by GitHub
parent 095c1c1759
commit cc065f0055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 128 additions and 29 deletions

View File

@ -22,6 +22,8 @@
<NoWarn>$(NoWarn);NU5125</NoWarn>
<!-- Suppress warnings about using SemVer 2.0. -->
<NoWarn>$(NoWarn);NU5105</NoWarn>
<!-- Don't make missing XML docs a fatal build error, but still surface so we have visibility into undocumented APIs. -->
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS1591</WarningsNotAsErrors>
<!-- Contact email address for NuGet packages and Linux installers. -->
<MaintainerEmail>nugetaspnet@microsoft.com</MaintainerEmail>
@ -34,6 +36,8 @@
<IncludeSource>false</IncludeSource>
<IncludeSymbols>true</IncludeSymbols>
<DefaultNetCoreTargetFramework>netcoreapp$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</DefaultNetCoreTargetFramework>
<SharedFxProductName>$(Product) $(PackageVersion) Shared Framework</SharedFxProductName>
<SharedFxDescription>Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub ($(RepositoryUrl)). We happily accept issues and PRs.</SharedFxDescription>
</PropertyGroup>
@ -134,6 +138,7 @@
<IsTestProject Condition="$(MSBuildProjectName.EndsWith('Tests')) OR $(MSBuildProjectName.EndsWith('.Test'))">true</IsTestProject>
<IsTestAssetProject Condition="$(RepoRelativeProjectDir.Contains('testassets'))">true</IsTestAssetProject>
<IsSampleProject Condition="$(RepoRelativeProjectDir.Contains('sample'))">true</IsSampleProject>
<IsAnalyzersProject Condition="$(MSBuildProjectName.EndsWith('.Analyzers'))">true</IsAnalyzersProject>
<DisableDeterministicSourceRoot Condition="'$(IsSampleProject)' == 'true' OR '$(IsTestAssetProject)' == 'true'">true</DisableDeterministicSourceRoot>
</PropertyGroup>

View File

@ -10,6 +10,9 @@
<PackageOutputPath Condition=" '$(IsShippingPackage)' == 'true' ">$(ArtifactsShippingPackagesDir)</PackageOutputPath>
<PackageOutputPath Condition=" '$(IsShippingPackage)' != 'true' ">$(ArtifactsNonShippingPackagesDir)</PackageOutputPath>
<!-- Analyzers package are special. In general, they should not have dependencies in the nuspec. Analyzer assemblies are not meant to be used for compilation or runtime. -->
<SuppressDependenciesWhenPacking Condition="'$(SuppressDependenciesWhenPacking)' == '' AND '$(IsAnalyzersProject)' == 'true'">true</SuppressDependenciesWhenPacking>
</PropertyGroup>
<PropertyGroup Condition=" '$(MSBuildProjectExtension)' == '.csproj' ">
@ -47,7 +50,7 @@
<PropertyGroup>
<!-- Implementation projects are the projects which produce nuget packages or shipping assemblies. -->
<IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND '$(IsTestAssetProject)' != 'true' AND '$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true' AND '$(IsSampleProject)' != 'true' ">true</IsImplementationProject>
<IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND '$(IsAnalyzersProject)' != 'true' AND '$(IsTestAssetProject)' != 'true' AND '$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true' AND '$(IsSampleProject)' != 'true' ">true</IsImplementationProject>
<!-- This determines whether a project is available as a <Reference> to other projects in this repo. -->
<IsProjectReferenceProvider Condition=" '$(IsProjectReferenceProvider)' == '' AND '$(IsImplementationProject)' == 'true' AND '$(PackAsTool)' != 'true' ">true</IsProjectReferenceProvider>
@ -56,12 +59,12 @@
<VerifyVersion>false</VerifyVersion>
<EnableApiCheck Condition=" '$(EnableApiCheck)' != '' ">$(IsImplementationProject)</EnableApiCheck>
<IsPackable Condition="'$(IsPackable)' == '' AND '$(IsImplementationProject)' == 'true' ">true</IsPackable>
<IsPackable Condition="'$(IsPackable)' == '' AND ('$(IsImplementationProject)' == 'true' OR '$(IsAnalyzersProject)' == 'true') ">true</IsPackable>
<IsPackable Condition="'$(IsPackable)' == '' ">false</IsPackable>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
<BuildHelixPayload Condition="'$(BuildHelixPayload)' == '' AND '$(IsTestProject)' == 'true'">true</BuildHelixPayload>
<BuildHelixPayload Condition="'$(BuildHelixPayload)' == '' AND '$(IsTestProject)' == 'true'">true</BuildHelixPayload>
</PropertyGroup>
<Import Project="eng\targets\ResolveIisReferences.targets" Condition=" '$(MSBuildProjectExtension)' != '.vcxproj' " />
@ -74,8 +77,8 @@
<!-- Move to CSharp.Common.props -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' AND '$(IsHelixJob)' == 'true' ">
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
</ItemGroup>
</ItemGroup>
<!-- Prepares the test projects for helix by including xunit and publishing -->
<Target Name="PrepareHelixPayload" Returns="@(HelixDirectory)">
<ItemGroup>
@ -90,9 +93,9 @@
</MSBuild>
</Target>
<Target Name="_PrepareHelixPayloadInner"
DependsOnTargets="Publish"
Condition="'$(BuildHelixPayload)' == 'true'"
<Target Name="_PrepareHelixPayloadInner"
DependsOnTargets="Publish"
Condition="'$(BuildHelixPayload)' == 'true'"
Returns="@(HelixDirectory)">
<ItemGroup>
@ -126,9 +129,9 @@
<Copy SourceFiles="@(XunitConsoleRunnerFiles)" DestinationFolder="$(PublishDir)" />
</Target>
<Target Name="_CreateHelixPayloadInner"
DependsOnTargets="CollectXunitConsoleRunner"
Condition="($(IsWindowsHelixQueue) OR '$(TargetFrameworkIdentifier)' != '.NETFramework')"
<Target Name="_CreateHelixPayloadInner"
DependsOnTargets="CollectXunitConsoleRunner"
Condition="($(IsWindowsHelixQueue) OR '$(TargetFrameworkIdentifier)' != '.NETFramework')"
Returns="@(HelixPayload)">
<ConvertToAbsolutePath Paths="$(PublishDir)">

View File

@ -142,6 +142,7 @@
the entire pattern will silently fail to evaluate correctly.
-->
<DotNetProjects Include="
$(RepositoryRoot)src\Framework\ref\Microsoft.AspNetCore.App.Ref.csproj;
$(RepositoryRoot)src\DefaultBuilder\**\*.*proj;
$(RepositoryRoot)src\Features\JsonPatch\**\*.*proj;
$(RepositoryRoot)src\DataProtection\**\*.*proj;

View File

@ -90,8 +90,6 @@
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Razor.Runtime" ProjectPath="$(RepositoryRoot)src\Razor\Razor.Runtime\src\Microsoft.AspNetCore.Razor.Runtime.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Razor" ProjectPath="$(RepositoryRoot)src\Razor\Razor\src\Microsoft.AspNetCore.Razor.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Abstractions" ProjectPath="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.Abstractions\Microsoft.AspNetCore.Mvc.Abstractions.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Analyzers" ProjectPath="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.Analyzers\Microsoft.AspNetCore.Mvc.Analyzers.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Api.Analyzers" ProjectPath="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.Api.Analyzers\Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.ApiExplorer" ProjectPath="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.ApiExplorer\Microsoft.AspNetCore.Mvc.ApiExplorer.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Core" ProjectPath="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.Core\Microsoft.AspNetCore.Mvc.Core.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Cors" ProjectPath="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.Cors\Microsoft.AspNetCore.Mvc.Cors.csproj" />

View File

@ -7,8 +7,6 @@
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<Description>Roslyn analyzers for ASP.NET Core Components.</Description>
<IsShippingPackage>true</IsShippingPackage>
<!-- Manually set to false because other projects should not reference this assembly as a project reference, except for the analyzer's unit tests. -->
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
</PropertyGroup>
<ItemGroup>

View File

@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Support for rendering ASP.NET Core components for browsers.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsShippingPackage>true</IsShippingPackage>
</PropertyGroup>

View File

@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Components feature for ASP.NET Core.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsShippingPackage>true</IsShippingPackage>
</PropertyGroup>

View File

@ -26,6 +26,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
/// </summary>
/// <param name="serviceProvider">The <see cref="IServiceProvider"/> to use to instantiate components.</param>
/// <param name="htmlEncoder">A <see cref="Func{T, TResult}"/> that will HTML encode the given string.</param>
/// <param name="dispatcher"></param>
public HtmlRenderer(IServiceProvider serviceProvider, Func<string, string> htmlEncoder, IDispatcher dispatcher)
: base(serviceProvider, dispatcher)
{

View File

@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
/// <summary>
/// Invokes the given <see cref="Func{TResult}"/> in the context of the associated <see cref="Renderer"/>.
/// </summary>
/// <param name="asyncAction">The asynchronous function to execute.</param>
/// <param name="asyncFunction">The asynchronous function to execute.</param>
/// <returns>A <see cref="Task{TResult}"/> that will be completed when the function has finished executing.</returns>
Task<TResult> InvokeAsync<TResult>(Func<Task<TResult>> asyncFunction);
}

View File

@ -0,0 +1,98 @@
<Project>
<PropertyGroup>
<OutputInRepoRoot>true</OutputInRepoRoot>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Import Project="..\Microsoft.AspNetCore.App.props" />
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<IsShippingPackage>true</IsShippingPackage>
<PackageDescription>Provides a default set of APIs for building an ASP.NET Core application. Contains reference assemblies, documentation, and other design-time assets.
This package is an internal implementation of the .NET Core SDK and is not meant to be used as a normal PackageReference.</PackageDescription>
<PackageTags>aspnetcore;targeting-pack</PackageTags>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<!-- Subject to change: see https://github.com/dotnet/designs/pull/50 -->
<PackageType>TargetingPack</PackageType>
<RefAssemblyPackagePath>ref/$(TargetFramework)/</RefAssemblyPackagePath>
<!-- There are no symbols for reference assemblies. -->
<IncludeSymbols>false</IncludeSymbols>
<!-- The project representing the shared framework doesn't produce a .NET assembly or symbols. -->
<DebugType>none</DebugType>
<IncludeBuildOutput>false</IncludeBuildOutput>
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<GenerateDependencyFile>false</GenerateDependencyFile>
<!-- This project should not be referenced via the `<Reference>` impementation. -->
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
</PropertyGroup>
<ItemGroup>
<Reference Include="@(Dependency)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
_ResolveTargetingPackContent;
_BatchCopyToOutputDirectory;
</BuildDependsOn>
</PropertyGroup>
<!-- Override the default MSBuild targets so that nothing is returned from the project since it represents a collection of assemblies. -->
<Target Name="GetTargetPath" />
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)">
<Message Importance="High" Text="$(MSBuildProjectName) -> $(TargetDir)" />
</Target>
<!-- This project doesn't compile anything. -->
<Target Name="CoreCompile" />
<!-- Completely disable default targets for copying to output. -->
<Target Name="CopyFilesToOutputDirectory" />
<!-- This target finds the reference assemblies. -->
<Target Name="_ResolveTargetingPackContent"
BeforeTargets="_GetPackageFiles"
DependsOnTargets="ResolveReferences;FindReferenceAssembliesForReferences">
<ItemGroup>
<AspNetCoreReferenceAssemblyPath
Include="@(ReferencePathWithRefAssemblies)"
Exclude="@(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'Microsoft.NETCore.App'))" />
<AspNetCoreReferenceDocXml Include="@(AspNetCoreReferenceAssemblyPath->'%(RootDir)%(Directory)%(FileName).xml')" />
<!-- Exclude known missing XML docs files. Time-boxing this workaround because we want XML docs for everything. This can be removed when we get a new build with https://github.com/dotnet/core-setup/pull/5109. -->
<AspNetCoreReferenceDocXml Remove="@(AspNetCoreReferenceDocXml)"
Condition="'$(MicrosoftNETCoreAppPackageVersion)' == '3.0.0-preview-27405-2' AND ('%(FileName)' == 'Microsoft.Extensions.DependencyModel' OR '%(FileName)' == 'Microsoft.DotNet.PlatformAbstractions' )" />
<RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" />
<RefPackContent Include="@(AspNetCoreReferenceDocXml)" />
<_PackageFiles Include="@(RefPackContent)" PackagePath="$(RefAssemblyPackagePath)" />
</ItemGroup>
</Target>
<!-- Written to take advantage of target batching in MSBuild. -->
<Target Name="_BatchCopyToOutputDirectory"
DependsOnTargets="_ResolveTargetingPackContent"
Inputs="@(RefPackContent)"
Outputs="@(RefPackContent->'$(TargetDir)%(FileName)%(Extension)')">
<Copy SourceFiles="@(RefPackContent)"
DestinationFiles="@(RefPackContent->'$(TargetDir)%(FileName)%(Extension)')"
UseHardlinksIfPossible="true" />
</Target>
</Project>

View File

@ -8,7 +8,7 @@
<PropertyGroup>
<RuntimeIdentifier>$(TargetRuntimeIdentifier)</RuntimeIdentifier>
<TargetFramework>netcoreapp$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</TargetFramework>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<BaseSharedFrameworkName>Microsoft.NETCore.App</BaseSharedFrameworkName>
<RuntimeFrameworkVersion>$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>

View File

@ -18,9 +18,6 @@
<Target Name="PopulateNuspec" BeforeTargets="GenerateNuspec" DependsOnTargets="Build">
<PropertyGroup>
<!-- Make sure we create a symbols.nupkg. -->
<IncludeSymbols>true</IncludeSymbols>
<NuspecProperties>
id=$(PackageId);
version=$(PackageVersion);

View File

@ -23,9 +23,6 @@
<Target Name="PopulateNuspec" BeforeTargets="GenerateNuspec" DependsOnTargets="Build">
<PropertyGroup>
<!-- Make sure we create a symbols.nupkg. -->
<IncludeSymbols>true</IncludeSymbols>
<NuspecProperties>
id=$(PackageId);
version=$(PackageVersion);

View File

@ -9,7 +9,6 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Analyzers" PrivateAssets="None" />
<Reference Include="Microsoft.AspNetCore.Mvc.ApiExplorer" />
<Reference Include="Microsoft.AspNetCore.Mvc.Cors" />
<Reference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" />

View File

@ -13,9 +13,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Analyzers\Microsoft.AspNetCore.Mvc.Analyzers.csproj" />
<Reference Include="Microsoft.AspNetCore.Mvc" />
<Reference Include="Microsoft.AspNetCore.Mvc.Analyzers" />
<Reference Include="Microsoft.AspNetCore.Analyzer.Testing" />
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
</ItemGroup>

View File

@ -13,9 +13,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Api.Analyzers\Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj" />
<Reference Include="Microsoft.AspNetCore.Mvc" />
<Reference Include="Microsoft.AspNetCore.Mvc.Api.Analyzers" />
<Reference Include="Microsoft.AspNetCore.Analyzer.Testing" />
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
</ItemGroup>

View File

@ -3,6 +3,7 @@
<PropertyGroup>
<Description>Runtime infrastructure for rendering Razor pages and tag helpers.</Description>
<TargetFramework>netcoreapp3.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>$(PackageTags);taghelper;taghelpers</PackageTags>
</PropertyGroup>

View File

@ -9,6 +9,7 @@ Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute
Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute
Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper</Description>
<TargetFramework>netcoreapp3.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>$(PackageTags);taghelper;taghelpers</PackageTags>
<!-- Required to implement an HtmlEncoder -->