Skip to content

Commit 0f46375

Browse files
authored
Refactor .NET Core Desktop workflow configuration
Updated the .NET Core Desktop workflow to include environment variable configurations and improved comments for clarity.
1 parent d6df290 commit 0f46375

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: .NET Core Desktop Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
11+
build:
12+
13+
strategy:
14+
matrix:
15+
configuration: [Debug, Release]
16+
17+
runs-on: windows-latest
18+
19+
env:
20+
Solution_Name: ShowWrite.sln # 替换为你的解决方案名称
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
# 安装 .NET Core SDK
29+
- name: Install .NET Core
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: 8.0.x
33+
34+
# 添加 MSBuild 到 PATH
35+
- name: Setup MSBuild.exe
36+
uses: microsoft/setup-msbuild@v2
37+
38+
# 还原 NuGet 包
39+
- name: Restore NuGet packages
40+
run: dotnet restore $env:Solution_Name
41+
42+
# 构建解决方案
43+
- name: Build solution
44+
run: msbuild $env:Solution_Name /p:Configuration=${{ matrix.configuration }} /p:Platform="Any CPU" /t:Build
45+
46+
# 可选:执行单元测试(如果有测试项目)
47+
# - name: Run unit tests
48+
# run: dotnet test --no-build --verbosity normal

0 commit comments

Comments
 (0)