diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 18ae95b..a0adf91 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -55,30 +55,55 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Setup MSBuild for .NET Framework + - name: Setup MSBuild uses: microsoft/setup-msbuild@v1.1 + + - name: Download NuGet.exe + run: | + Invoke-WebRequest -Uri "https://dist.nuget.org/win-x86-commandline/v6.6.1/nuget.exe" -OutFile "nuget.exe" - name: Restore NuGet packages run: | - nuget restore ${{ env.SOLUTION_FILE }} + .\nuget restore ${{ env.SOLUTION_FILE }} -Verbosity detailed -PackagesDirectory packages + + - name: Diagnostic - Check project structure + run: | + # 检查项目文件 + Get-ChildItem -Recurse -Filter *.csproj | ForEach-Object { + Write-Host "Project: $($_.Name)" + Get-Content $_.FullName | Select-String "PackageReference|Reference" + } + + - name: Diagnostic - Check NuGet packages + run: | + # 检查包恢复情况 + if (Test-Path "packages") { + Get-ChildItem -Recurse packages | ForEach-Object { Write-Host "Package: $($_.FullName)" } + } - name: Build .NET Framework 4.0 project run: | - msbuild Revit.Async.NET40/Revit.Async.NET40.csproj /p:Configuration=Release /p:Platform="x64" /p:TargetFrameworkVersion=v4.0 + $solutionFile = "${{ env.SOLUTION_FILE }}" + $solutionDir = [System.IO.Path]::GetDirectoryName((Get-Item $solutionFile).FullName) + msbuild Revit.Async.NET40/Revit.Async.NET40.csproj /p:Configuration=Release /p:Platform="x64" /p:TargetFrameworkVersion=v4.0 /p:SolutionDir="$solutionDir\" - name: Build .NET Framework 4.5 project run: | - msbuild Revit.Async/Revit.Async.csproj /p:Configuration=Release /p:Platform="x64" /p:TargetFrameworkVersion=v4.5 + $solutionFile = "${{ env.SOLUTION_FILE }}" + $solutionDir = [System.IO.Path]::GetDirectoryName((Get-Item $solutionFile).FullName) + msbuild Revit.Async/Revit.Async.csproj /p:Configuration=Release /p:Platform="x64" /p:TargetFrameworkVersion=v4.5 /p:SolutionDir="$solutionDir\" - name: Build .NET Standard 2.1 project run: | - dotnet build Revit.Async.NET.Standard/Revit.Async.NET.Standard.csproj --configuration Release --framework netstandard2.1 + $solutionFile = "${{ env.SOLUTION_FILE }}" + $solutionDir = [System.IO.Path]::GetDirectoryName((Get-Item $solutionFile).FullName) + dotnet build Revit.Async.NET.Standard/Revit.Async.NET.Standard.csproj --configuration Release --framework netstandard2.1 /p:SolutionDir="$solutionDir\" - name: Upload build artifacts uses: actions/upload-artifact@v4 diff --git a/Revit.Async.NET40/Revit.Async.NET40.csproj b/Revit.Async.NET40/Revit.Async.NET40.csproj index f1d987a..46b33f6 100644 --- a/Revit.Async.NET40/Revit.Async.NET40.csproj +++ b/Revit.Async.NET40/Revit.Async.NET40.csproj @@ -114,6 +114,8 @@ False + + diff --git a/Revit.Async.NET40/packages.config b/Revit.Async.NET40/packages.config index 89863bc..cc85147 100644 --- a/Revit.Async.NET40/packages.config +++ b/Revit.Async.NET40/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Revit.Async/Revit.Async.csproj b/Revit.Async/Revit.Async.csproj index 1fa9bdc..b4027af 100644 --- a/Revit.Async/Revit.Async.csproj +++ b/Revit.Async/Revit.Async.csproj @@ -109,6 +109,8 @@ + + diff --git a/Revit.Async/packages.config b/Revit.Async/packages.config index 32f5cca..68b3835 100644 --- a/Revit.Async/packages.config +++ b/Revit.Async/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file