From ce8088f9a3153b32e079deda406fc98b0fa4e90a Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 13 Apr 2018 10:16:06 +0100 Subject: [PATCH] Inject MSBuild properties into templates during build --- build/sources.props | 1 + .../.gitignore | 3 ++ .../Directory.Build.props | 9 ++--- ...crosoft.AspNetCore.Blazor.Templates.csproj | 36 +++++++++++++++++- ...crosoft.AspNetCore.Blazor.Templates.nuspec | 2 +- .../SetPackageProperties.targets | 17 +++++++++ .../dotnetcli.host.json | 0 .../icon.png | Bin .../template.json | 13 +++++++ .../vs-2017.3.host.json | 0 .../BlazorHosted.CSharp.Client.csproj | 14 ++++--- .../BlazorHosted.CSharp.Server.csproj | 14 ++++--- .../dotnetcli.host.json | 0 .../icon.png | Bin .../template.json | 13 +++++++ .../BlazorLibrary.CSharp.csproj | 14 ++++--- .../dotnetcli.host.json | 0 .../icon.png | Bin .../template.json | 13 +++++++ .../vs-2017.3.host.json | 0 .../BlazorStandalone.CSharp.csproj | 16 ++++---- 21 files changed, 133 insertions(+), 32 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Blazor.Templates/.gitignore rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/{.template.config => .template.config.src}/dotnetcli.host.json (100%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/{.template.config => .template.config.src}/icon.png (100%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/{.template.config => .template.config.src}/template.json (87%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/{.template.config => .template.config.src}/vs-2017.3.host.json (100%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/{.template.config => .template.config.src}/dotnetcli.host.json (100%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/{.template.config => .template.config.src}/icon.png (100%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/{.template.config => .template.config.src}/template.json (76%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/{.template.config => .template.config.src}/dotnetcli.host.json (100%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/{.template.config => .template.config.src}/icon.png (100%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/{.template.config => .template.config.src}/template.json (81%) rename src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/{.template.config => .template.config.src}/vs-2017.3.host.json (100%) diff --git a/build/sources.props b/build/sources.props index 8c5d2ada6e..e4f91c6272 100644 --- a/build/sources.props +++ b/build/sources.props @@ -12,6 +12,7 @@ $(RestoreSources); https://api.nuget.org/v3/index.json; + https://dotnet.myget.org/f/blazor-dev/api/v3/index.json; diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/.gitignore b/src/Microsoft.AspNetCore.Blazor.Templates/.gitignore new file mode 100644 index 0000000000..3a6dfa23a4 --- /dev/null +++ b/src/Microsoft.AspNetCore.Blazor.Templates/.gitignore @@ -0,0 +1,3 @@ +# We only track the .template.config.src items in source control +# The .template.config files are generated on build +content/**/.template.config/ diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/Directory.Build.props b/src/Microsoft.AspNetCore.Blazor.Templates/Directory.Build.props index 424a791efb..edf55eba97 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/Directory.Build.props +++ b/src/Microsoft.AspNetCore.Blazor.Templates/Directory.Build.props @@ -1,8 +1,7 @@ - + + 0.2.0-preview1-10195 + - + diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.csproj b/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.csproj index 0579cd70f8..f933c72cbf 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.csproj +++ b/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.csproj @@ -1,4 +1,4 @@ - + netstandard20 Microsoft.AspNetCore.Blazor.Templates.nuspec @@ -7,4 +7,38 @@ False 2008 + + + + + <_TemplateConfigMainFile Include="content\**\.template.config.src\template.json" /> + <_TemplateConfigDir Include="@(_TemplateConfigMainFile->'$([System.IO.Path]::GetDirectoryName('%(_TemplateConfigMainFile.FullPath)'))')" /> + <_TemplateConfigFileToCopy Include="%(_TemplateConfigDir.Identity)\**\*.*"> + $([System.IO.Path]::GetDirectoryName('%(_TemplateConfigDir.Identity)'))\.template.config\ + + + + + + + + + %(DestDir)%(RecursiveDir)%(Filename)%(Extension) + $(GeneratedContentProperties) + + + + + + + + diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.nuspec b/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.nuspec index f5c607e7c3..0936c02b41 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.nuspec +++ b/src/Microsoft.AspNetCore.Blazor.Templates/Microsoft.AspNetCore.Blazor.Templates.nuspec @@ -19,7 +19,7 @@ diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/SetPackageProperties.targets b/src/Microsoft.AspNetCore.Blazor.Templates/SetPackageProperties.targets index d98dae4333..1e44dd848d 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/SetPackageProperties.targets +++ b/src/Microsoft.AspNetCore.Blazor.Templates/SetPackageProperties.targets @@ -1,10 +1,27 @@ + $(NuspecProperties); version=$(PackageVersion); + + + + false + true + + + + IncludeCustomRestoreSources=$(IncludeCustomRestoreSourcesValue); + TemplateBlazorVersion=$(PackageVersion); + + + diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/dotnetcli.host.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/dotnetcli.host.json similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/dotnetcli.host.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/dotnetcli.host.json diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/icon.png b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/icon.png similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/icon.png rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/icon.png diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/template.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/template.json similarity index 87% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/template.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/template.json index 99d79b413e..992a79e2a0 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/template.json +++ b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/template.json @@ -86,6 +86,19 @@ "type": "bind", "binding": "HostIdentifier" }, + "IncludeCustomRestoreSourcesSymbol": { + "type": "parameter", + "datatype": "bool", + "description": "If set, includes restore sources for the Blazor MyGet feed.", + "defaultValue": "${IncludeCustomRestoreSources}" + }, + "TemplateBlazorVersionSymbol": { + "type": "parameter", + "datatype": "string", + "description": "Specifies which version of Blazor packages to use.", + "replaces": "$(TemplateBlazorPackageVersion)", + "defaultValue": "${TemplateBlazorVersion}" + }, "skipRestore": { "type": "parameter", "datatype": "bool", diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/vs-2017.3.host.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/vs-2017.3.host.json similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config/vs-2017.3.host.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/.template.config.src/vs-2017.3.host.json diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Client/BlazorHosted.CSharp.Client.csproj b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Client/BlazorHosted.CSharp.Client.csproj index c934e08844..90c456cc71 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Client/BlazorHosted.CSharp.Client.csproj +++ b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Client/BlazorHosted.CSharp.Client.csproj @@ -1,17 +1,19 @@ - + netstandard2.0 Exe - - - $(RestoreSources);https://dotnet.myget.org/f/blazor-dev/api/v3/index.json + + $(RestoreSources); + https://api.nuget.org/v3/index.json; + https://dotnet.myget.org/f/blazor-dev/api/v3/index.json; + - - + + diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Server/BlazorHosted.CSharp.Server.csproj b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Server/BlazorHosted.CSharp.Server.csproj index 069a75debd..f576fec6e7 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Server/BlazorHosted.CSharp.Server.csproj +++ b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted.CSharp/BlazorHosted.CSharp.Server/BlazorHosted.CSharp.Server.csproj @@ -1,19 +1,21 @@ - + netcoreapp2.1 - - - $(RestoreSources);https://dotnet.myget.org/f/blazor-dev/api/v3/index.json + + $(RestoreSources); + https://api.nuget.org/v3/index.json; + https://dotnet.myget.org/f/blazor-dev/api/v3/index.json; + - + - + diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config/dotnetcli.host.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config.src/dotnetcli.host.json similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config/dotnetcli.host.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config.src/dotnetcli.host.json diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config/icon.png b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config.src/icon.png similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config/icon.png rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config.src/icon.png diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config/template.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config.src/template.json similarity index 76% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config/template.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config.src/template.json index 8037a7ea93..a2cf1faa23 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config/template.json +++ b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/.template.config.src/template.json @@ -47,6 +47,19 @@ "type": "bind", "binding": "HostIdentifier" }, + "IncludeCustomRestoreSourcesSymbol": { + "type": "parameter", + "datatype": "bool", + "description": "If set, includes restore sources for the Blazor MyGet feed.", + "defaultValue": "${IncludeCustomRestoreSources}" + }, + "TemplateBlazorVersionSymbol": { + "type": "parameter", + "datatype": "string", + "description": "Specifies which version of Blazor packages to use.", + "replaces": "$(TemplateBlazorPackageVersion)", + "defaultValue": "${TemplateBlazorVersion}" + }, "skipRestore": { "type": "parameter", "datatype": "bool", diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/BlazorLibrary.CSharp.csproj b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/BlazorLibrary.CSharp.csproj index 3afa5b4749..54832495be 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/BlazorLibrary.CSharp.csproj +++ b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorLibrary.CSharp/BlazorLibrary.CSharp.csproj @@ -1,13 +1,15 @@ - + netstandard2.0 library true false - - - https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;$(RestoreSources) + + $(RestoreSources); + https://api.nuget.org/v3/index.json; + https://dotnet.myget.org/f/blazor-dev/api/v3/index.json; + @@ -19,8 +21,8 @@ - - + + diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/dotnetcli.host.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/dotnetcli.host.json similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/dotnetcli.host.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/dotnetcli.host.json diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/icon.png b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/icon.png similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/icon.png rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/icon.png diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/template.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/template.json similarity index 81% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/template.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/template.json index b56d17679d..f96067277e 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/template.json +++ b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/template.json @@ -65,6 +65,19 @@ }, "replaces": "61501" }, + "IncludeCustomRestoreSourcesSymbol": { + "type": "parameter", + "datatype": "bool", + "description": "If set, includes restore sources for the Blazor MyGet feed.", + "defaultValue": "${IncludeCustomRestoreSources}" + }, + "TemplateBlazorVersionSymbol": { + "type": "parameter", + "datatype": "string", + "description": "Specifies which version of Blazor packages to use.", + "replaces": "$(TemplateBlazorPackageVersion)", + "defaultValue": "${TemplateBlazorVersion}" + }, "skipRestore": { "type": "parameter", "datatype": "bool", diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/vs-2017.3.host.json b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/vs-2017.3.host.json similarity index 100% rename from src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config/vs-2017.3.host.json rename to src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/.template.config.src/vs-2017.3.host.json diff --git a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/BlazorStandalone.CSharp.csproj b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/BlazorStandalone.CSharp.csproj index de29a743ef..064bf35d2a 100644 --- a/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/BlazorStandalone.CSharp.csproj +++ b/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone.CSharp/BlazorStandalone.CSharp.csproj @@ -1,19 +1,21 @@ - + netstandard2.0 dotnet blazor serve - - - $(RestoreSources);https://dotnet.myget.org/f/blazor-dev/api/v3/index.json + + $(RestoreSources); + https://api.nuget.org/v3/index.json; + https://dotnet.myget.org/f/blazor-dev/api/v3/index.json; + - - - + + +