[Templating] Razor class library for components (#7461)
* [Components] Razor class library for components * Updates the Razor Class Library to be a portable components library by default. * Adds an option to support the old RCL that includes support for Views and pages. * Usage: * `dotnet new razorclasslib` produces the same traditional Razor Class Library. * `dotnet new razorclasslib -s false` produces a Razor Class Library without views and pages support.
This commit is contained in:
parent
c1bc210e8e
commit
6827bb7443
|
|
@ -25,6 +25,7 @@
|
|||
<!-- 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\Components\src\Microsoft.AspNetCore.Components.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" />
|
||||
|
|
|
|||
|
|
@ -1,12 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(SupportPagesAndViews)' == 'True'">netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(SupportPagesAndViews)' != 'True'">netstandard2.0</TargetFramework>
|
||||
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Company.RazorClassLibrary1</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(SupportPagesAndViews)' == 'True'">
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(SupportPagesAndViews)' != 'True'">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components" Version="${MicrosoftAspNetCoreComponentsPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Build" Version="${MicrosoftAspNetCoreComponentsBuildPackageVersion}" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"SupportPagesAndViews": {
|
||||
"longName": "support-pages-and-views",
|
||||
"shortName": "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,16 @@
|
|||
},
|
||||
"sourceName": "Company.RazorClassLibrary1",
|
||||
"preferNameDirectory": true,
|
||||
"sources": [
|
||||
{
|
||||
"modifiers": [{
|
||||
"condition": "(!SupportPagesAndViews)",
|
||||
"exclude": [
|
||||
"Areas/**"
|
||||
]
|
||||
}]
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
|
|
@ -42,6 +52,12 @@
|
|||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
},
|
||||
"SupportPagesAndViews": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "true",
|
||||
"description": "Whether to support adding traditional Razor pages and Views in addition to components to this library."
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue