Skip to content

Commit 33bc457

Browse files
authored
Convert ProjectTemplates to build using ProjectReferences (#6935)
1 parent eef9f76 commit 33bc457

File tree

510 files changed

+275
-543
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

510 files changed

+275
-543
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ korebuild-lock.txt
3232
.gradle/
3333
src/SignalR/clients/**/dist/
3434
modules/
35-
.template.config/
35+
36+
# Template config files for blazor templates is generated on-build
37+
src/Components/**/.template.config/

Directory.Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@
8787
<InstallersOutputPath>$(ArtifactsDir)installers\$(Configuration)\</InstallersOutputPath>
8888
</PropertyGroup>
8989

90+
<!-- Ensure these output paths exist. -->
91+
<ItemGroup>
92+
<CreateDirectory Include="$(ArtifactsShippingPackagesDir)" />
93+
<CreateDirectory Include="$(ArtifactsNonShippingPackagesDir)" />
94+
<CreateDirectory Include="$(InstallersOutputPath)" />
95+
</ItemGroup>
96+
9097
<PropertyGroup Condition=" '$(OutputInRepoRoot)' == 'true' ">
9198
<BaseOutputPath>$(RepositoryRoot)bin\$(Configuration)\$(MSBuildProjectName)\</BaseOutputPath>
9299
<OutputPath>$(BaseOutputPath)</OutputPath>

build/buildorder.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
</ItemDefinitionGroup>
88

99
<ItemGroup>
10-
<RepositoryBuildOrder Include="Templating" Order="18" />
1110
</ItemGroup>
1211
</Project>

build/repo.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
$(RepositoryRoot)src\SignalR\clients\cpp\**\*.*proj;
6161
$(RepositoryRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
6262
$(RepositoryRoot)src\Components\Blazor\Templates\src\content\**\*.*proj;
63+
$(RepositoryRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.csproj;
64+
$(RepositoryRoot)src\ProjectTemplates\Web.Spa.ProjectTemplates\content\**\*.csproj;
6365
" />
6466
</ItemGroup>
6567

@@ -125,6 +127,10 @@
125127
@(ProjectToBuild);
126128
@(ProjectToExclude);" />
127129

130+
<!--
131+
Use caution to avoid deep recursion. If the globbing pattern picks up something which exceeds MAX_PATH,
132+
the entire pattern will silently fail to evaluate correctly.
133+
-->
128134
<ProjectToBuild Condition=" '$(BuildManaged)' == 'true' "
129135
Include="
130136
$(RepositoryRoot)src\DefaultBuilder\**\*.*proj;
@@ -146,6 +152,9 @@
146152
$(RepositoryRoot)src\MusicStore\**\*.*proj;
147153
$(RepositoryRoot)src\SignalR\**\*.csproj;
148154
$(RepositoryRoot)src\Components\**\*.csproj;
155+
$(RepositoryRoot)src\ProjectTemplates\*\*.csproj;
156+
$(RepositoryRoot)src\ProjectTemplates\test\*.csproj;
157+
$(RepositoryRoot)src\ProjectTemplates\testassets\*\*.csproj;
149158
"
150159
Exclude="
151160
@(ProjectToBuild);

build/repo.targets

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@
182182
<_NoBuildSolution Update="@(_NoBuildSolution)" Build="false" />
183183
<Solution Include="@(_NoBuildSolution);@(_ShippedSolution)" />
184184
</ItemGroup>
185-
186-
<Error Text="No solutions were found in '$(SubmoduleRoot)'. Did you forget to clone the submodules? Run `git submodule update --init`." Condition="@(Solution->Count()) == 0" />
187185
</Target>
188186

189187
<Target Name="GeneratePropsFiles" DependsOnTargets="PrepareOutputPaths;GetArtifactInfo">

build/submodules.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@
3636
</PropertyGroup>
3737

3838
<ItemGroup>
39-
<Repository Include="Templating" PatchPolicy="AlwaysUpdateAndCascadeVersions" />
4039
</ItemGroup>
4140
</Project>

eng/Dependencies.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ and are generated based on the last package release.
117117
<LatestPackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
118118
<LatestPackageReference Include="Selenium.Support" Version="$(SeleniumSupportPackageVersion)" />
119119
<LatestPackageReference Include="Selenium.WebDriver.ChromeDriver" Version="$(SeleniumWebDriverChromeDriverPackageVersion)" />
120+
<LatestPackageReference Include="Selenium.WebDriver.MicrosoftDriver" Version="$(SeleniumWebDriverMicrosoftDriverPackageVersion)" />
120121
<LatestPackageReference Include="Selenium.WebDriver" Version="$(SeleniumWebDriverPackageVersion)" />
121122
<LatestPackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" />
122123
<LatestPackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFilePackageVersion)" />

eng/targets/Packaging.targets

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
<Target Name="_GetPackageVersionInfo" DependsOnTargets="$(GetPackageVersionDependsOn)"
3333
Returns="@(_ProjectPathWithVersion)">
3434
<ItemGroup>
35-
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)">
36-
<PackageId>$(MSBuildProjectName)</PackageId>
35+
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)" Condition="'$(IsPackable)' == 'true'">
36+
<PackageId>$(PackageId)</PackageId>
3737
<PackageVersion Condition="'$(PackageVersion)' != ''">$(PackageVersion)</PackageVersion>
38+
<VersionVariableName>$(PackageId.Replace('.',''))PackageVersion</VersionVariableName>
3839
</_ProjectPathWithVersion>
3940
</ItemGroup>
4041
</Target>

src/Middleware/SpaServices.Extensions/src/Microsoft.AspNetCore.SpaServices.Extensions.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
<ItemGroup>
1010
<Reference Include="Microsoft.AspNetCore.SpaServices" />
11-
</ItemGroup>
12-
13-
<ItemGroup>
1411
<Reference Include="Microsoft.AspNetCore.StaticFiles" />
1512
<Reference Include="Microsoft.AspNetCore.WebSockets" />
1613
<Reference Include="Microsoft.Extensions.FileProviders.Physical" />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
3+
4+
<PropertyGroup>
5+
<!-- The .csproj files in this folder do not actually produce .dll's. They are only present to produce .nupkgs and enable Visual Studio support -->
6+
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
7+
</PropertyGroup>
8+
9+
<Import Project="TemplateProjects.props" Condition="'$(IsTestProject)' != 'true' AND '$(IsTestAssetProject)' != 'true'" />
10+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" />
3+
4+
<PropertyGroup>
5+
<EnableApiCheck>false</EnableApiCheck>
6+
</PropertyGroup>
7+
8+
<Import Project="GenerateContent.targets" />
9+
<Import Project="SetPackageProperties.targets" />
10+
</Project>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<Project>
2+
<PropertyGroup>
3+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
4+
5+
<!-- Use for incremental builds. When versions or dependencies of templates change, this file is updated and causes a re-build. -->
6+
<_GenerateContentPropertiesHashFile>$(IntermediateOutputPath)$(MSBuildProjectName).content.g.cache</_GenerateContentPropertiesHashFile>
7+
8+
<!-- The version of the shared framework. This is used in tests to ensure they run against the shared framework version we just built. -->
9+
<GeneratedContentProperties>
10+
$(GeneratedContentProperties);
11+
MicrosoftAspNetCoreAppPackageVersion=$(SharedFxVersion);
12+
</GeneratedContentProperties>
13+
</PropertyGroup>
14+
15+
<!--
16+
Generates content using MSBuild variables.
17+
-->
18+
<Target Name="GetPackageVersionVariables">
19+
<!-- This target is defined in eng/targets/Packaging.targets -->
20+
<MSBuild Projects="@(PackageVersionVariableReference)"
21+
BuildInParallel="true"
22+
Targets="_GetPackageVersionInfo">
23+
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedPackageVersionVariableReference" />
24+
</MSBuild>
25+
26+
<PropertyGroup>
27+
<GeneratedContentProperties>
28+
$(GeneratedContentProperties);
29+
@(_ResolvedPackageVersionVariableReference->'%(VersionVariableName)=%(PackageVersion)')</GeneratedContentProperties>
30+
</PropertyGroup>
31+
32+
<Hash ItemsToHash="$(GeneratedContentProperties)">
33+
<Output TaskParameter="HashResult" PropertyName="_GeneratedContentPropertiesHash" />
34+
</Hash>
35+
36+
<WriteLinesToFile Overwrite="true" Lines="$(_GeneratedContentPropertiesHash)" File="$(_GenerateContentPropertiesHashFile)" WriteOnlyWhenDifferent="true" />
37+
</Target>
38+
39+
<Target Name="GenerateContent"
40+
DependsOnTargets="GetPackageVersionVariables"
41+
BeforeTargets="CoreCompile"
42+
Inputs="$(MSBuildAllProjects);$(_GenerateContentPropertiesHashFile);@(GeneratedContent)"
43+
Outputs="@(GeneratedContent->'%(OutputPath)')">
44+
45+
<Sdk_GenerateFileFromTemplate
46+
TemplateFile="%(GeneratedContent.Identity)"
47+
Properties="$(GeneratedContentProperties);%(GeneratedContent.AdditionalProperties)"
48+
OutputPath="%(GeneratedContent.OutputPath)">
49+
50+
<Output TaskParameter="OutputPath" ItemName="FileWrites" />
51+
<Output TaskParameter="OutputPath" ItemName="Content" />
52+
</Sdk_GenerateFileFromTemplate>
53+
</Target>
54+
</Project>
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<Project>
2-
<Import Project="..\Directory.Build.props" />
32

43
<PropertyGroup>
5-
<EnableApiCheck>false</EnableApiCheck>
64
<EnableDefaultItems>False</EnableDefaultItems>
75
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
86
<IncludeBuildOutput>False</IncludeBuildOutput>
9-
<NoWarn>2008;8021</NoWarn>
7+
<IncludeSource>false</IncludeSource>
8+
<IncludeSymbols>false</IncludeSymbols>
9+
<NoWarn>$(NoWarn);2008;8021</NoWarn>
1010
<PackageTags>aspnet;templates</PackageTags>
1111
<NuspecFile>$(MSBuildThisFileDirectory)templates.nuspec</NuspecFile>
1212
<NuspecBasePath>$(MSBuildProjectDirectory)</NuspecBasePath>
13+
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
14+
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
1315
</PropertyGroup>
1416

1517
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' == 'true'">
@@ -18,11 +20,7 @@
1820
</PropertyGroup>
1921

2022
<ItemGroup>
21-
<None Include="Content/**" />
22-
</ItemGroup>
23-
24-
<ItemGroup>
25-
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(InternalAspNetCoreSdkPackageVersion)" PrivateAssets="All" />
23+
<None Include="content/**" />
2624
</ItemGroup>
2725

2826
</Project>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<PackageId>Microsoft.DotNet.Web.ProjectTemplates.$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</PackageId>
6+
<Description>ASP.NET Core Web Template Pack for Microsoft Template Engine
7+
8+
To install the templates in this package, run 'dotnet new --install $(PackageId)::$(PackageVersion)'.</Description>
9+
<IsShippingPackage>true</IsShippingPackage>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<!-- We don't need to code sign these .js files because they are not used in Windows Script Host. -->
14+
<ExcludePackageFileFromSigning Include="content\**\*.js" />
15+
16+
<!-- Similarly, not applicable to sign fonts -->
17+
<ExcludePackageFileFromSigning Include="content\**\*.ttf" />
18+
<ExcludePackageFileFromSigning Include="content\**\*.otf" />
19+
</ItemGroup>
20+
21+
22+
<PropertyGroup>
23+
<!-- Lists the versions of dependencies not built in this repo. Packages produced from this repo should be listed as a PackageVersionVariableReference. -->
24+
<GeneratedContentProperties>
25+
MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion);
26+
MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion);
27+
MicrosoftEntityFrameworkCoreToolsPackageVersion=$(MicrosoftEntityFrameworkCoreToolsPackageVersion);
28+
MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion);
29+
MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion);
30+
</GeneratedContentProperties>
31+
</PropertyGroup>
32+
33+
<ItemGroup>
34+
<!-- These projects product packages that the templates depend on. See GenerateContent.targets -->
35+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Azure\AzureAD\Authentication.AzureAD.UI\src\Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj" />
36+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Azure\AzureAD\Authentication.AzureADB2C.UI\src\Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj" />
37+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Components\Browser\src\Microsoft.AspNetCore.Components.Browser.csproj" />
38+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Components\Build\src\Microsoft.AspNetCore.Components.Build.csproj" />
39+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Components\Server\src\Microsoft.AspNetCore.Components.Server.csproj" />
40+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Identity\EntityFrameworkCore\src\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" />
41+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Identity\UI\src\Microsoft.AspNetCore.Identity.UI.csproj" />
42+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Middleware\Diagnostics.EntityFrameworkCore\src\Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.csproj" />
43+
<PackageVersionVariableReference Include="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.NewtonsoftJson\Microsoft.AspNetCore.Mvc.NewtonsoftJson.csproj" />
44+
</ItemGroup>
45+
46+
<ItemGroup>
47+
<GeneratedContent Include="EmptyWeb-CSharp.csproj.in" OutputPath="content/EmptyWeb-CSharp/Company.WebApplication1.csproj" />
48+
<GeneratedContent Include="EmptyWeb-FSharp.fsproj.in" OutputPath="content/EmptyWeb-FSharp/Company.WebApplication1.fsproj" />
49+
<GeneratedContent Include="RazorComponentsWeb-CSharp.App.csproj.in" OutputPath="content/RazorComponentsWeb-CSharp/RazorComponentsWeb-CSharp.App/RazorComponentsWeb-CSharp.App.csproj" />
50+
<GeneratedContent Include="RazorComponentsWeb-CSharp.Server.csproj.in" OutputPath="content/RazorComponentsWeb-CSharp/RazorComponentsWeb-CSharp.Server/RazorComponentsWeb-CSharp.Server.csproj" />
51+
<GeneratedContent Include="RazorPagesWeb-CSharp.csproj.in" OutputPath="content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj" />
52+
<GeneratedContent Include="RazorClassLibrary-CSharp.csproj.in" OutputPath="content/RazorClassLibrary-CSharp/Company.RazorClassLibrary1.csproj" />
53+
<GeneratedContent Include="StarterWeb-CSharp.csproj.in" OutputPath="content/StarterWeb-CSharp/Company.WebApplication1.csproj" />
54+
<GeneratedContent Include="StarterWeb-FSharp.fsproj.in" OutputPath="content/StarterWeb-FSharp/Company.WebApplication1.fsproj" />
55+
<GeneratedContent Include="WebApi-CSharp.csproj.in" OutputPath="content/WebApi-CSharp/Company.WebApplication1.csproj" />
56+
<GeneratedContent Include="WebApi-FSharp.fsproj.in" OutputPath="content/WebApi-FSharp/Company.WebApplication1.fsproj" />
57+
</ItemGroup>
58+
59+
</Project>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="${MicrosoftAspNetCoreComponentsPackageVersion}" />
11-
<PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="${MicrosoftAspNetCoreComponentsPackageVersion}" PrivateAssets="all" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="${MicrosoftAspNetCoreComponentsBrowserPackageVersion}" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="${MicrosoftAspNetCoreComponentsBuildPackageVersion}" PrivateAssets="all" />
1212
</ItemGroup>
1313

1414
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.Components.Server" Version="${MicrosoftAspNetCoreComponentsPackageVersion}" />
14+
<PackageReference Include="Microsoft.AspNetCore.Components.Server" Version="${MicrosoftAspNetCoreComponentsServerPackageVersion}" />
1515
</ItemGroup>
1616

1717
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
2-
<Import Project="..\..\..\build\sources.props" />
2+
<Import Project="..\..\..\..\build\sources.props" />
33
<!--
44
This file intentionally left mostly blank to ensure the template projects
55
are independent from the template package build config (other than to share

0 commit comments

Comments
 (0)