Convert ProjectTemplates to build using ProjectReferences (#6935)

This commit is contained in:
Nate McMaster 2019-01-23 15:54:47 -08:00 committed by GitHub
parent eef9f76759
commit 33bc4576da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
510 changed files with 275 additions and 543 deletions

4
.gitignore vendored
View File

@ -32,4 +32,6 @@ korebuild-lock.txt
.gradle/
src/SignalR/clients/**/dist/
modules/
.template.config/
# Template config files for blazor templates is generated on-build
src/Components/**/.template.config/

View File

@ -87,6 +87,13 @@
<InstallersOutputPath>$(ArtifactsDir)installers\$(Configuration)\</InstallersOutputPath>
</PropertyGroup>
<!-- Ensure these output paths exist. -->
<ItemGroup>
<CreateDirectory Include="$(ArtifactsShippingPackagesDir)" />
<CreateDirectory Include="$(ArtifactsNonShippingPackagesDir)" />
<CreateDirectory Include="$(InstallersOutputPath)" />
</ItemGroup>
<PropertyGroup Condition=" '$(OutputInRepoRoot)' == 'true' ">
<BaseOutputPath>$(RepositoryRoot)bin\$(Configuration)\$(MSBuildProjectName)\</BaseOutputPath>
<OutputPath>$(BaseOutputPath)</OutputPath>

View File

@ -7,6 +7,5 @@
</ItemDefinitionGroup>
<ItemGroup>
<RepositoryBuildOrder Include="Templating" Order="18" />
</ItemGroup>
</Project>

View File

@ -60,6 +60,8 @@
$(RepositoryRoot)src\SignalR\clients\cpp\**\*.*proj;
$(RepositoryRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
$(RepositoryRoot)src\Components\Blazor\Templates\src\content\**\*.*proj;
$(RepositoryRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.csproj;
$(RepositoryRoot)src\ProjectTemplates\Web.Spa.ProjectTemplates\content\**\*.csproj;
" />
</ItemGroup>
@ -125,6 +127,10 @@
@(ProjectToBuild);
@(ProjectToExclude);" />
<!--
Use caution to avoid deep recursion. If the globbing pattern picks up something which exceeds MAX_PATH,
the entire pattern will silently fail to evaluate correctly.
-->
<ProjectToBuild Condition=" '$(BuildManaged)' == 'true' "
Include="
$(RepositoryRoot)src\DefaultBuilder\**\*.*proj;
@ -146,6 +152,9 @@
$(RepositoryRoot)src\MusicStore\**\*.*proj;
$(RepositoryRoot)src\SignalR\**\*.csproj;
$(RepositoryRoot)src\Components\**\*.csproj;
$(RepositoryRoot)src\ProjectTemplates\*\*.csproj;
$(RepositoryRoot)src\ProjectTemplates\test\*.csproj;
$(RepositoryRoot)src\ProjectTemplates\testassets\*\*.csproj;
"
Exclude="
@(ProjectToBuild);

View File

@ -182,8 +182,6 @@
<_NoBuildSolution Update="@(_NoBuildSolution)" Build="false" />
<Solution Include="@(_NoBuildSolution);@(_ShippedSolution)" />
</ItemGroup>
<Error Text="No solutions were found in '$(SubmoduleRoot)'. Did you forget to clone the submodules? Run `git submodule update --init`." Condition="@(Solution->Count()) == 0" />
</Target>
<Target Name="GeneratePropsFiles" DependsOnTargets="PrepareOutputPaths;GetArtifactInfo">

View File

@ -36,6 +36,5 @@
</PropertyGroup>
<ItemGroup>
<Repository Include="Templating" PatchPolicy="AlwaysUpdateAndCascadeVersions" />
</ItemGroup>
</Project>

View File

@ -117,6 +117,7 @@ and are generated based on the last package release.
<LatestPackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
<LatestPackageReference Include="Selenium.Support" Version="$(SeleniumSupportPackageVersion)" />
<LatestPackageReference Include="Selenium.WebDriver.ChromeDriver" Version="$(SeleniumWebDriverChromeDriverPackageVersion)" />
<LatestPackageReference Include="Selenium.WebDriver.MicrosoftDriver" Version="$(SeleniumWebDriverMicrosoftDriverPackageVersion)" />
<LatestPackageReference Include="Selenium.WebDriver" Version="$(SeleniumWebDriverPackageVersion)" />
<LatestPackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" />
<LatestPackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFilePackageVersion)" />

View File

@ -32,9 +32,10 @@
<Target Name="_GetPackageVersionInfo" DependsOnTargets="$(GetPackageVersionDependsOn)"
Returns="@(_ProjectPathWithVersion)">
<ItemGroup>
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)">
<PackageId>$(MSBuildProjectName)</PackageId>
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)" Condition="'$(IsPackable)' == 'true'">
<PackageId>$(PackageId)</PackageId>
<PackageVersion Condition="'$(PackageVersion)' != ''">$(PackageVersion)</PackageVersion>
<VersionVariableName>$(PackageId.Replace('.',''))PackageVersion</VersionVariableName>
</_ProjectPathWithVersion>
</ItemGroup>
</Target>

View File

@ -8,9 +8,6 @@
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.SpaServices" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.StaticFiles" />
<Reference Include="Microsoft.AspNetCore.WebSockets" />
<Reference Include="Microsoft.Extensions.FileProviders.Physical" />

View File

@ -0,0 +1,10 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
<PropertyGroup>
<!-- The .csproj files in this folder do not actually produce .dll's. They are only present to produce .nupkgs and enable Visual Studio support -->
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
</PropertyGroup>
<Import Project="TemplateProjects.props" Condition="'$(IsTestProject)' != 'true' AND '$(IsTestAssetProject)' != 'true'" />
</Project>

View File

@ -0,0 +1,10 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" />
<PropertyGroup>
<EnableApiCheck>false</EnableApiCheck>
</PropertyGroup>
<Import Project="GenerateContent.targets" />
<Import Project="SetPackageProperties.targets" />
</Project>

View File

@ -0,0 +1,54 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<!-- Use for incremental builds. When versions or dependencies of templates change, this file is updated and causes a re-build. -->
<_GenerateContentPropertiesHashFile>$(IntermediateOutputPath)$(MSBuildProjectName).content.g.cache</_GenerateContentPropertiesHashFile>
<!-- The version of the shared framework. This is used in tests to ensure they run against the shared framework version we just built. -->
<GeneratedContentProperties>
$(GeneratedContentProperties);
MicrosoftAspNetCoreAppPackageVersion=$(SharedFxVersion);
</GeneratedContentProperties>
</PropertyGroup>
<!--
Generates content using MSBuild variables.
-->
<Target Name="GetPackageVersionVariables">
<!-- This target is defined in eng/targets/Packaging.targets -->
<MSBuild Projects="@(PackageVersionVariableReference)"
BuildInParallel="true"
Targets="_GetPackageVersionInfo">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedPackageVersionVariableReference" />
</MSBuild>
<PropertyGroup>
<GeneratedContentProperties>
$(GeneratedContentProperties);
@(_ResolvedPackageVersionVariableReference->'%(VersionVariableName)=%(PackageVersion)')</GeneratedContentProperties>
</PropertyGroup>
<Hash ItemsToHash="$(GeneratedContentProperties)">
<Output TaskParameter="HashResult" PropertyName="_GeneratedContentPropertiesHash" />
</Hash>
<WriteLinesToFile Overwrite="true" Lines="$(_GeneratedContentPropertiesHash)" File="$(_GenerateContentPropertiesHashFile)" WriteOnlyWhenDifferent="true" />
</Target>
<Target Name="GenerateContent"
DependsOnTargets="GetPackageVersionVariables"
BeforeTargets="CoreCompile"
Inputs="$(MSBuildAllProjects);$(_GenerateContentPropertiesHashFile);@(GeneratedContent)"
Outputs="@(GeneratedContent->'%(OutputPath)')">
<Sdk_GenerateFileFromTemplate
TemplateFile="%(GeneratedContent.Identity)"
Properties="$(GeneratedContentProperties);%(GeneratedContent.AdditionalProperties)"
OutputPath="%(GeneratedContent.OutputPath)">
<Output TaskParameter="OutputPath" ItemName="FileWrites" />
<Output TaskParameter="OutputPath" ItemName="Content" />
</Sdk_GenerateFileFromTemplate>
</Target>
</Project>

View File

@ -1,15 +1,17 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<EnableApiCheck>false</EnableApiCheck>
<EnableDefaultItems>False</EnableDefaultItems>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<IncludeBuildOutput>False</IncludeBuildOutput>
<NoWarn>2008;8021</NoWarn>
<IncludeSource>false</IncludeSource>
<IncludeSymbols>false</IncludeSymbols>
<NoWarn>$(NoWarn);2008;8021</NoWarn>
<PackageTags>aspnet;templates</PackageTags>
<NuspecFile>$(MSBuildThisFileDirectory)templates.nuspec</NuspecFile>
<NuspecBasePath>$(MSBuildProjectDirectory)</NuspecBasePath>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' == 'true'">
@ -18,11 +20,7 @@
</PropertyGroup>
<ItemGroup>
<None Include="Content/**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(InternalAspNetCoreSdkPackageVersion)" PrivateAssets="All" />
<None Include="content/**" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PackageId>Microsoft.DotNet.Web.ProjectTemplates.$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</PackageId>
<Description>ASP.NET Core Web Template Pack for Microsoft Template Engine
To install the templates in this package, run 'dotnet new --install $(PackageId)::$(PackageVersion)'.</Description>
<IsShippingPackage>true</IsShippingPackage>
</PropertyGroup>
<ItemGroup>
<!-- We don't need to code sign these .js files because they are not used in Windows Script Host. -->
<ExcludePackageFileFromSigning Include="content\**\*.js" />
<!-- Similarly, not applicable to sign fonts -->
<ExcludePackageFileFromSigning Include="content\**\*.ttf" />
<ExcludePackageFileFromSigning Include="content\**\*.otf" />
</ItemGroup>
<PropertyGroup>
<!-- Lists the versions of dependencies not built in this repo. Packages produced from this repo should be listed as a PackageVersionVariableReference. -->
<GeneratedContentProperties>
MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion);
MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion);
MicrosoftEntityFrameworkCoreToolsPackageVersion=$(MicrosoftEntityFrameworkCoreToolsPackageVersion);
MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion);
MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion);
</GeneratedContentProperties>
</PropertyGroup>
<ItemGroup>
<!-- These projects product packages that the templates depend on. See GenerateContent.targets -->
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Azure\AzureAD\Authentication.AzureAD.UI\src\Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Azure\AzureAD\Authentication.AzureADB2C.UI\src\Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Components\Browser\src\Microsoft.AspNetCore.Components.Browser.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Components\Build\src\Microsoft.AspNetCore.Components.Build.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Components\Server\src\Microsoft.AspNetCore.Components.Server.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Identity\EntityFrameworkCore\src\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Identity\UI\src\Microsoft.AspNetCore.Identity.UI.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Middleware\Diagnostics.EntityFrameworkCore\src\Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.csproj" />
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.NewtonsoftJson\Microsoft.AspNetCore.Mvc.NewtonsoftJson.csproj" />
</ItemGroup>
<ItemGroup>
<GeneratedContent Include="EmptyWeb-CSharp.csproj.in" OutputPath="content/EmptyWeb-CSharp/Company.WebApplication1.csproj" />
<GeneratedContent Include="EmptyWeb-FSharp.fsproj.in" OutputPath="content/EmptyWeb-FSharp/Company.WebApplication1.fsproj" />
<GeneratedContent Include="RazorComponentsWeb-CSharp.App.csproj.in" OutputPath="content/RazorComponentsWeb-CSharp/RazorComponentsWeb-CSharp.App/RazorComponentsWeb-CSharp.App.csproj" />
<GeneratedContent Include="RazorComponentsWeb-CSharp.Server.csproj.in" OutputPath="content/RazorComponentsWeb-CSharp/RazorComponentsWeb-CSharp.Server/RazorComponentsWeb-CSharp.Server.csproj" />
<GeneratedContent Include="RazorPagesWeb-CSharp.csproj.in" OutputPath="content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj" />
<GeneratedContent Include="RazorClassLibrary-CSharp.csproj.in" OutputPath="content/RazorClassLibrary-CSharp/Company.RazorClassLibrary1.csproj" />
<GeneratedContent Include="StarterWeb-CSharp.csproj.in" OutputPath="content/StarterWeb-CSharp/Company.WebApplication1.csproj" />
<GeneratedContent Include="StarterWeb-FSharp.fsproj.in" OutputPath="content/StarterWeb-FSharp/Company.WebApplication1.fsproj" />
<GeneratedContent Include="WebApi-CSharp.csproj.in" OutputPath="content/WebApi-CSharp/Company.WebApplication1.csproj" />
<GeneratedContent Include="WebApi-FSharp.fsproj.in" OutputPath="content/WebApi-FSharp/Company.WebApplication1.fsproj" />
</ItemGroup>
</Project>

View File

@ -7,8 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="${MicrosoftAspNetCoreComponentsPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="${MicrosoftAspNetCoreComponentsPackageVersion}" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="${MicrosoftAspNetCoreComponentsBrowserPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="${MicrosoftAspNetCoreComponentsBuildPackageVersion}" PrivateAssets="all" />
</ItemGroup>
</Project>

View File

@ -11,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Server" Version="${MicrosoftAspNetCoreComponentsPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.Components.Server" Version="${MicrosoftAspNetCoreComponentsServerPackageVersion}" />
</ItemGroup>
</Project>

View File

@ -1,5 +1,5 @@
<Project>
<Import Project="..\..\..\build\sources.props" />
<Import Project="..\..\..\..\build\sources.props" />
<!--
This file intentionally left mostly blank to ensure the template projects
are independent from the template package build config (other than to share

Some files were not shown because too many files have changed in this diff Show More