add target to .NET 7 (#2810)

* docs: update .NET7 RC2

* fix target framework

* update to .net 7 GA

* update yaml

* fix wasmhost

* update document
This commit is contained in:
James Yeung 2022-11-10 16:00:11 +08:00 committed by GitHub
parent 6760a41806
commit e4834ed1da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 90 additions and 143 deletions

View File

@ -35,6 +35,11 @@ jobs:
with:
dotnet-version: 6.0.101
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
- uses: actions/setup-node@v1
with:
node-version: "10.x"
@ -125,7 +130,7 @@ jobs:
run: |
npm install
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net7 -o cargo
env:
PACKAGE_VERSION: ${{ steps.pack.outputs.package_version }}

View File

@ -1,110 +0,0 @@
name: 🔂 Surge PR Preview
on:
issue_comment:
types: [created]
jobs:
preview:
name: Preview
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/preview')
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@0.9.0
name: Prepare preview ⛏
env:
RUN_PATH: https://github.com/ant-design-blazor/ant-design-blazor/actions/runs/${{ github.run_id }}
with:
github-token: ${{ github.token }}
script: |
const REPLACE_MARK = '<!-- PREVIEW_UPDATE_COMMENT -->';
const comment = `[<img width="306" src="https://user-images.githubusercontent.com/5378891/72351368-2c979e00-371b-11ea-9652-eb4e825d745e.gif">](${process.env.RUN_PATH})`;
const wrappedComment = `
${REPLACE_MARK}
${comment}
`.trim();
let comments = await github.issues.listComments(context.issue);
// Find my comment
const updateComment = comments.data.find(({ body }) => body.includes(REPLACE_MARK));
// eslint-disable-next-line no-console
console.log('Origin comment:', updateComment);
let res;
if (!updateComment) {
res = await github.issues.createComment({...context.issue, body: wrappedComment })
} else {
res = await github.issues.updateComment({...context.issue, comment_id: updateComment.id, body: wrappedComment })
}
console.log(res);
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: Checkout & Building ⚙
env:
PULL_NUMBER: ${{ github.event.issue.number }}
run: |
git init
git remote add origin https://github.com/ant-design-blazor/ant-design-blazor.git
git fetch origin pull/$PULL_NUMBER/head:fork
git checkout fork
npm install
dotnet build
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo
- name: Deploy Preview 🚀
env:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
DEPLOY_DOMAIN: preview-${{ github.run_id }}-ant-design-blazor.surge.sh
run: |
npm install -g surge
surge --project ./cargo/wwwroot --domain $DEPLOY_DOMAIN
- uses: actions/github-script@0.9.0
name: Show preview ⛏
env:
DEPLOY_DOMAIN: https://preview-${{ github.run_id }}-ant-design-blazor.surge.sh
with:
github-token: ${{ github.token }}
script: |
const REPLACE_MARK = '<!-- PREVIEW_UPDATE_COMMENT -->';
const comment = `[<img width="306" src="https://user-images.githubusercontent.com/5378891/72400743-23dbb200-3785-11ea-9d13-1a2d92743846.png">](${process.env.DEPLOY_DOMAIN})`;
const wrappedComment = `
${REPLACE_MARK}
${comment}
`.trim();
let comments = await github.issues.listComments(context.issue);
// Find my comment
const updateComment = comments.data.find(({ body }) => body.includes(REPLACE_MARK));
// eslint-disable-next-line no-console
console.log('Origin comment:', updateComment);
let res;
if (!updateComment) {
res = await github.issues.createComment({...context.issue, body: wrappedComment })
} else {
res = await github.issues.updateComment({...context.issue, comment_id: updateComment.id, body: wrappedComment })
}
console.log(res);
# https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/m-p/38186#M3250
always_job:
name: Always run job
runs-on: ubuntu-latest
steps:
- name: Always run
run: echo "This job is used to prevent the workflow to fail when all other jobs are skipped."

View File

@ -23,6 +23,11 @@ jobs:
with:
dotnet-version: 6.0.101
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
- name: Setup Node.js
uses: actions/setup-node@v1
with:
@ -39,7 +44,7 @@ jobs:
npm install
dotnet build
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o _site
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net7 -o _site
env:
PACKAGE_VERSION: ${{ github.event.number }}

View File

@ -28,6 +28,11 @@ jobs:
with:
dotnet-version: 6.0.101
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
- uses: actions/setup-node@v1
with:
node-version: "10.x"

View File

@ -31,6 +31,11 @@ jobs:
with:
dotnet-version: 6.0.101
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
- uses: actions/setup-node@v1
with:
node-version: "10.x"
@ -52,7 +57,7 @@ jobs:
sed -i s/{version}/$VERSION/g ./site/AntDesign.Docs.Wasm/wwwroot/index.html
sed -i s/{version}/$VERSION/g ./site/AntDesign.Docs.Wasm/wwwroot/service-worker.published.js
dotnet build
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo -p:EnableAOT=true
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net7 -o cargo -p:EnableAOT=true
cp -rf cargo/staticwebapp.config.json cargo/wwwroot
- name: Deploy to Azure 🚀

View File

@ -31,6 +31,11 @@ jobs:
with:
dotnet-version: 6.0.101
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
- uses: actions/setup-node@v1
with:
node-version: "10.x"

View File

@ -164,7 +164,7 @@ WebAssembly 静态托管页面示例
### 本地
- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/6.0?WT.mc_id=DT-MVP-5003987) 6.0.100 以上版本
- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.100 以上版本
- 安装 Node.js只用于样式文件和互操作所需 TS 文件的构建)
- 克隆到本地开发

View File

@ -169,7 +169,7 @@ Click the button below to start a new workspace for development for free.
### Local
- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/6.0?WT.mc_id=DT-MVP-5003987) 6.0.100 or later.
- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.100 or later.
- Install Node.js (only for building style files and interoperable TypeScript files)
- Clone to local development

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5;net6</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net5;net6;net7</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
@ -65,6 +65,14 @@
</PackageReference>
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net7'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.DataAnnotations.Validation" Version="3.2.0-rc1.20223.4" />
<PackageReference Include="OneOf" Version="2.1.155" />

View File

@ -3,10 +3,13 @@ using Microsoft.AspNetCore.Components;
namespace AntDesign
{
#if NET7_0_OR_GREATER
#else
[EventHandler("onmouseleave", typeof(EventArgs))]
[EventHandler("onmouseenter", typeof(EventArgs))]
public static class EventHandlers
{
}
#endif
}

View File

@ -12,7 +12,7 @@ using Microsoft.Extensions.Logging;
namespace AntDesign
{
#if NET6_0
#if NET6_0_OR_GREATER
[CascadingTypeParameter(nameof(TItem))]
#endif

View File

@ -30,7 +30,7 @@ Following the Ant Design specification, we developed a Blazor Components library
- 💕 Supports WebAssembly-based client-side and SignalR-based server-side UI event interaction.
- 🎨 Supports Progressive Web Applications (PWA).
- 🛡 Build with C#, a multi-paradigm static language for an efficient development experience.
- ⚙️ .NET Standard 2.1/.NET 5 based, with direct reference to the rich .NET ecosystem.
- ⚙️ .NET Standard 2.1 ~ .NET 7 based, with direct reference to the rich .NET ecosystem.
- 🎁 Seamless integration with existing ASP.NET Core MVC and Razor Pages projects.
## 🌈 Online Examples
@ -41,8 +41,8 @@ WebAssembly static hosting examples:
## 🖥 Environment Support
- .NET Core 3.1 / .NET 5 / .NET 6
- Blazor WebAssembly 3.2 / .NET 5 / .NET 6 Release
- .NET Core 3.1 / .NET 5 / .NET 6 / .NET 7
- Blazor WebAssembly 3.2 / .NET 5 / .NET 6 / .NET 7 Release
- Supports two-way binding on the server side
- Supports WebAssembly static file deployment
- Support 4 major browsers engines, and Internet Explorer 11+ ([Blazor Server](https://docs.microsoft.com/en-us/aspnet/core/blazor/supported-platforms?view=aspnetcore-6.0&WT.mc_id=DT-MVP-5003987) only)
@ -148,7 +148,7 @@ Options for the template
## 🔨 Local Development
- Install [.NET Core SDK](https://dotnet.microsoft.com/download?WT.mc_id=DT-MVP-5003987) 6.0.x or later.
- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.x or later.
- Install Node.js (only for building style files and interoperable TypeScript files)
- Clone to local development

View File

@ -40,8 +40,8 @@ title: Ant Design of Blazor
## 🖥 支持环境
- 兼容 .NET Core 3.1 / .NET 5 / .NET 6
- 最新支持 Blazor WebAssembly 6.0 正式版
- 兼容 .NET Core 3.1 / .NET 5 / .NET 6 / .NET 7
- 最新支持 Blazor WebAssembly 7.0 正式版
- 支持服务端双向绑定
- 支持 WebAssembly 静态文件部署
- 主流 4 款现代浏览器,以及 Internet Explorer 11+ (使用 [Blazor Server](https://docs.microsoft.com/zh-cn/aspnet/core/blazor/supported-platforms?view=aspnetcore-6.0&WT.mc_id=DT-MVP-5003987)
@ -145,7 +145,7 @@ title: Ant Design of Blazor
## 🔨 本地开发
- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/5.0?WT.mc_id=DT-MVP-5003987) 5.0.100 以上版本
- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/7.0?WT.mc_id=DT-MVP-5003987) 7.0.100 以上版本
- 安装 Node.js只用于样式文件和互操作所需 TS 文件的构建)
- 克隆到本地开发

View File

@ -21,8 +21,8 @@
"url": "https://github.com/ElderJames/ant-design-blazor/issues"
},
"scripts": {
"start": "dotnet watch -p ./site/AntDesign.Docs.Server run -f net6",
"start:wasm": "dotnet watch -p ./site/AntDesign.Docs.Wasm run -f net6",
"start": "dotnet watch -p ./site/AntDesign.Docs.Server run -f net7",
"start:wasm": "dotnet watch -p ./site/AntDesign.Docs.Wasm run -f net7",
"build:lib": "gulp build:library",
"build:doc": "gulp build:preview --max-old-space-size=81920",
"preinstall": "dotnet tool restore",

View File

@ -177,6 +177,10 @@
transform: rotate(405deg);
}
}
.loading-progress-text:after {
content: var(--blazor-load-percentage-text, "Loading");
}
</style>
<div style="display: flex; justify-content: center; align-items: center; flex-direction: column; min-height: 420px; height: 100%;">
<img src="logo.png" alt="logo" width="256">
@ -191,7 +195,7 @@
</div>
</div>
<div style="display: flex; justify-content: center; align-items: center;">
<img src="logo.png" width="32" style="margin-right: 8px;"> Ant Design of Blazor
<div class="loading-progress-text"></div>
</div>
</div>
</div>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6</TargetFrameworks>
<TargetFrameworks>net7</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SolutionDir)node_modules') ">
@ -38,8 +38,8 @@
<Target Name="RunCli" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug'">
<Copy SourceFiles="@(DocFiles)" DestinationFolder="$(ProjectDir)\wwwroot\docs\%(RecursiveDir)" ContinueOnError="true" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net6 --project $(CLIPath) demo2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net6 --project $(CLIPath) menu2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/docs $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net6 --project $(CLIPath) docs2html $(ProjectDir)/wwwroot/docs ./site/AntDesign.Docs/wwwroot/docs" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net7 --project $(CLIPath) demo2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net7 --project $(CLIPath) menu2json $(ProjectDir)/Demos $(ProjectDir)/wwwroot/docs $(ProjectDir)/wwwroot/meta" />
<Exec WorkingDirectory="$(SolutionDir)" Command="dotnet run -f net7 --project $(CLIPath) docs2html $(ProjectDir)/wwwroot/docs ./site/AntDesign.Docs/wwwroot/docs" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net6</TargetFrameworks>
<TargetFrameworks>net7</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
@ -29,6 +29,12 @@
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7'">
<PackageReference Include="BlazorPolyfill.Server">
<Version>6.0.100.1</Version>
</PackageReference>
</ItemGroup>
<Target Name="CopyDocs" BeforeTargets="Build">
<Copy SourceFiles="@(DocFiles)" DestinationFolder="$(ProjectDir)\wwwroot\docs\%(RecursiveDir)" ContinueOnError="true" />
</Target>

View File

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFrameworks>net6</TargetFrameworks>
<TargetFrameworks>net7</TargetFrameworks>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
<BlazorWebAssemblyLoadAllGlobalizationData>false</BlazorWebAssemblyLoadAllGlobalizationData>
</PropertyGroup>
<PropertyGroup Condition="$(EnableAOT) == 'true'">
@ -17,6 +17,13 @@
<PackageReference Include="Microsoft.AspNetCore.Components.Web.Extensions" Version="5.0.0-preview9.20513.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net7'">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web.Extensions" Version="5.0.0-preview9.20513.1" />
</ItemGroup>
<ItemGroup>
<EmscriptenEnvVars Include="PYTHONUTF8=1" />
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />

View File

@ -173,6 +173,10 @@
transform: rotate(405deg);
}
}
.loading-progress-text:after {
content: var(--blazor-load-percentage-text, "Loading");
}
</style>
<div style="display: flex; justify-content: center; align-items: center; flex-direction: column; min-height: 420px; height: 100%;">
<img src="/logo.png" alt="logo" width="256">
@ -187,7 +191,7 @@
</div>
</div>
<div style="display: flex; justify-content: center; align-items: center;">
<img src="/logo.png" width="32" style="margin-right: 8px;"> Ant Design of Blazor
<div class="loading-progress-text"></div>
</div>
</div>
</div>

View File

@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<TargetFramework>net7</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>net6</TargetFrameworks>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -8,7 +8,7 @@
Model _model = new();
AntDesign.Form<Model>? _form;
#if NET6_0
#if NET6_0_OR_GREATER
[Fact]
public void Form_EditContext_fires_OnFieldChange()
{
@ -36,7 +36,7 @@
}
#endif
#if NET6_0
#if NET6_0_OR_GREATER
[Fact]
public void Form_EditContext_Build_keep_OnFieldChange_subscription()
{

View File

@ -19,7 +19,7 @@
};
#if NET6_0
#if NET6_0_OR_GREATER
[Fact]
public void Form_EditContext_with_RulesModeValidation_and_CompositeModel_should_validate_properly()
{

View File

@ -6,7 +6,7 @@
public string Name { get; set; } = "";
}
#if NET6_0
#if NET6_0_OR_GREATER
[Fact]
public void Form_Model_is_updated()
{