Skip to content
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

Add new 'Umbraco Package RCL' project template #13460

Closed
Closed
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
1 change: 1 addition & 0 deletions templates/Umbraco.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<ItemGroup>
<Content Include="UmbracoPackage\**" Exclude="bin;obj" />
<Content Include="UmbracoPackageRcl\**" Exclude="bin;obj" />
<Content Include="UmbracoProject\**" Exclude="bin;obj" />
<Content Include="..\src\Umbraco.Web.UI\Program.cs">
<Link>UmbracoProject\Program.cs</Link>
Expand Down
10 changes: 7 additions & 3 deletions templates/UmbracoPackage/.template.config/dotnetcli.host.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
"$schema": "https://json.schemastore.org/dotnetcli.host.json",
"symbolInfo": {
"Framework": {
"longName": "Framework",
"shortName": "F"
"longName": "framework",
"isHidden": true
Comment on lines 4 to +6
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only allowed framework version is net7.0, so there's no need to show this parameter.

Since this value isn't supported on older Umbraco versions, any unaltered command would result in an ...is not a valid value... error, so I've also updated the capitalization to align with the default ASP.NET Core templates.

},
"UmbracoVersion": {
"longName": "version",
"shortName": "v"
"shortName": ""
},
"SkipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}
23 changes: 22 additions & 1 deletion templates/UmbracoPackage/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@
"description": "The version of Umbraco.Cms to add as PackageReference.",
"type": "parameter",
"datatype": "string",
"defaultValue": "10.0.0-rc1",
"defaultValue": "11.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is automatically updated in the Azure Pipelines build script (causing the generated NuGet package to always contain the same Umbraco version number as itself), but we might want to update the source to at least the latest major version or otherwise a more generic * version...

"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},
"SkipRestore": {
"displayName": "Skip restore",
"description": "If specified, skips the automatic restore of the project on create.",
"type": "parameter",
"datatype": "bool",
"defaultValue": "false"
},
"Namespace": {
"type": "derived",
"valueSource": "name",
Expand Down Expand Up @@ -83,5 +90,19 @@
{
"path": "UmbracoPackage.csproj"
}
],
"postActions": [
{
"id": "restore",
"condition": "(!SkipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
}
]
}
21 changes: 21 additions & 0 deletions templates/UmbracoPackageRcl/.template.config/dotnetcli.host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://json.schemastore.org/dotnetcli.host.json",
"symbolInfo": {
"Framework": {
"longName": "framework",
"isHidden": true
},
"UmbracoVersion": {
"longName": "version",
"shortName": ""
},
"SkipRestore": {
"longName": "no-restore",
"shortName": ""
},
"SupportPagesAndViews": {
"longName": "support-pages-and-views",
"shortName": "s"
}
}
}
20 changes: 20 additions & 0 deletions templates/UmbracoPackageRcl/.template.config/ide.host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/ide.host.json",
"order": 0,
"icon": "../../icon.png",
"description": {
"id": "UmbracoPackageRcl",
"text": "Umbraco Package RCL - An empty Umbraco package/plugin (Razor Class Library)."
},
"symbolInfo": [
{
"id": "UmbracoVersion",
"isVisible": true
},
{
"id": "SupportPagesAndViews",
"isVisible": true,
"persistenceScope": "templateGroup"
}
]
}
82 changes: 82 additions & 0 deletions templates/UmbracoPackageRcl/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"$schema": "https://json.schemastore.org/template.json",
"author": "Umbraco HQ",
"classifications": [
"Web",
"CMS",
"Umbraco",
"Package",
"Plugin",
"Razor Class Library"
],
"name": "Umbraco Package RCL",
"description": "An empty Umbraco package/plugin (Razor Class Library).",
"groupIdentity": "Umbraco.Templates.UmbracoPackageRcl",
"identity": "Umbraco.Templates.UmbracoPackageRcl.CSharp",
"shortName": "umbracopackage-rcl",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "UmbracoPackage",
"defaultName": "UmbracoPackage1",
"preferNameDirectory": true,
"symbols": {
"Framework": {
"displayName": "Framework",
"description": "The target framework for the project.",
"type": "parameter",
"datatype": "choice",
"choices": [
{
"displayName": ".NET 7.0",
"description": "Target net7.0",
"choice": "net7.0"
}
],
"defaultValue": "net7.0",
"replaces": "net7.0"
},
"UmbracoVersion": {
"displayName": "Umbraco version",
"description": "The version of Umbraco.Cms to add as PackageReference.",
"type": "parameter",
"datatype": "string",
"defaultValue": "11.0.0",
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},
"SkipRestore": {
"displayName": "Skip restore",
"description": "If specified, skips the automatic restore of the project on create.",
"type": "parameter",
"datatype": "bool",
"defaultValue": "false"
},
"SupportPagesAndViews": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"displayName": "Support pages and views",
"description": "Whether to support adding traditional Razor pages and Views to this library."
}
},
"primaryOutputs": [
{
"path": "UmbracoPackage.csproj"
}
],
"postActions": [
{
"id": "restore",
"condition": "(!SkipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
}
]
}
27 changes: 27 additions & 0 deletions templates/UmbracoPackageRcl/UmbracoPackage.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AddRazorSupportForMvc Condition="'$(SupportPagesAndViews)' == 'True'">true</AddRazorSupportForMvc>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">UmbracoPackage</RootNamespace>
<StaticWebAssetBasePath>App_Plugins/UmbracoPackage</StaticWebAssetBasePath>
</PropertyGroup>

<PropertyGroup>
<PackageId>UmbracoPackage</PackageId>
<Product>UmbracoPackage</Product>
<Title>UmbracoPackage</Title>
<Description>...</Description>
<PackageTags>umbraco plugin package</PackageTags>
</PropertyGroup>

<ItemGroup Condition="'$(SupportPagesAndViews)' == 'True'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms.Web.Website" Version="UMBRACO_VERSION_FROM_TEMPLATE" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="UMBRACO_VERSION_FROM_TEMPLATE" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions templates/UmbracoPackageRcl/wwwroot/package.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "UmbracoPackage",
"version": "",
"allowPackageTelemetry": true
}
19 changes: 10 additions & 9 deletions templates/UmbracoProject/.template.config/dotnetcli.host.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"$schema": "https://json.schemastore.org/dotnetcli.host.json",
"symbolInfo": {
"Framework": {
"longName": "Framework",
"shortName": "F"
"longName": "framework",
"isHidden": true
},
"UmbracoVersion": {
"longName": "version",
"shortName": "v"
"shortName": ""
},
"UseHttpsRedirect": {
"longName": "use-https-redirect",
Expand Down Expand Up @@ -55,14 +55,15 @@
},
"PackageProjectName": {
"longName": "PackageTestSiteName",
"shortName": "p"
"shortName": "p",
"isHidden": true
}
},
"usageExamples": [
"dotnet new umbraco -n MyNewProject",
"dotnet new umbraco -n MyNewProject --no-restore",
"dotnet new umbraco -n MyNewProject --development-database-type SQLite",
"dotnet new umbraco -n MyNewProject --development-database-type LocalDB",
"dotnet new umbraco -n MyNewProject --friendly-name \"Friendly Admin User\" --email admin@example.com --password password1234 --connection-string \"Server=ConnectionStringHere\""
"dotnet new umbraco --name MyNewProject",
"dotnet new umbraco --name MyNewProject --no-restore",
"dotnet new umbraco --name MyNewProject --development-database-type SQLite",
"dotnet new umbraco --name MyNewProject --development-database-type LocalDB",
"dotnet new umbraco --name MyNewProject --friendly-name \"Administrator\" --email admin@example.com --password 1234567890 --connection-string \"Server=(local);Database=MyNewProject;Trusted_Connection=True;\""
]
}
20 changes: 8 additions & 12 deletions templates/UmbracoProject/.template.config/ide.host.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@
},
{
"id": "UseHttpsRedirect",
"isVisible": true
},
{
"id": "SkipRestore",
"isVisible": true
"isVisible": true,
"persistenceScope": "templateGroup"
},
{
"id": "ExcludeGitignore",
"isVisible": true
"isVisible": true,
"persistenceScope": "templateGroup"
},
{
"id": "MinimalGitignore",
"isVisible": true
"isVisible": true,
"persistenceScope": "templateGroup"
},
{
"id": "ConnectionString",
Expand All @@ -37,7 +36,8 @@
},
{
"id": "DevelopmentDatabaseType",
"isVisible": true
"isVisible": true,
"persistenceScope": "templateGroup"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this persistenceScope value will make your IDE remember the last used value, making it easier to set your preferred options once and re-use that for all future projects created from this template.

},
{
"id": "UnattendedUserName",
Expand All @@ -54,10 +54,6 @@
{
"id": "NoNodesViewPath",
"isVisible": true
},
{
"id": "PackageProjectName",
"isVisible": true
}
]
}
2 changes: 1 addition & 1 deletion templates/UmbracoProject/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"description": "The version of Umbraco.Cms to add as PackageReference.",
"type": "parameter",
"datatype": "string",
"defaultValue": "10.0.0-rc1",
"defaultValue": "11.0.0",
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},
"UseHttpsRedirect": {
Expand Down