Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

The FluentMigrator.Analyzers.Tests project only targeted net8.0, while FluentMigrator.Tests conditionally targets net48 on Windows and net8.0 on Linux. This created inconsistent backwards compatibility coverage.

Changes

  • Added conditional targeting to FluentMigrator.Analyzers.Tests.csproj:
    • Targets net48 on Windows
    • Targets net8.0 on Linux
  • Added NUnit3TestAdapter package reference for test discovery
  • Updated CI workflow to install .NET Framework 4.8 Developer Pack on Windows runners to support net48 builds

Implementation

The project now uses the same MSBuild conditional pattern as FluentMigrator.Tests:

<Choose>
  <When Condition="$([MSBuild]::IsOSPlatform('Linux'))">
    <PropertyGroup>
      <TargetFramework>net8.0</TargetFramework>
    </PropertyGroup>
  </When>
  <Otherwise>
    <PropertyGroup>
      <TargetFramework>net48</TargetFramework>
    </PropertyGroup>
  </Otherwise>
</Choose>

The Microsoft.CodeAnalysis packages (v4.11.0) and testing packages (v1.1.2) support netstandard2.0 and net472+ respectively, ensuring compatibility with net48.

CI Workflow Fix

Fixed the NETSDK1005 error on Windows by installing the .NET Framework 4.8 Developer Pack before building. Windows Server 2025 (windows-latest) includes the .NET Framework 4.8.1 runtime but not the Developer Pack, which provides the necessary targeting pack and reference assemblies for building net48 projects with .NET SDK 9.

[!WARNING]

Original prompt

This section details on the original issue you should resolve

<filter_complete></filter_complete>

<issue_title>Should FluentMigrator.Analzyers.Tests also target net48?</issue_title>
<issue_description> </issue_description>

<agent_instructions>Determine if Fluent</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@jzabroski @copilot try again now
Original prompt

This section details on the original issue you should resolve

<issue_title>Should FluentMigrator.Analzyers.Tests also target net48?</issue_title>
<issue_description>

</issue_description>

<agent_instructions>Determine if Fluent</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@jzabroski @copilot try again now

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…yzers.Tests

- Update FluentMigrator.Analyzers.Tests.csproj to conditionally target net48 on Windows and net8.0 on Linux
- Add NUnit3TestAdapter package reference for test discovery
- Pattern now matches FluentMigrator.Tests.csproj for consistency
- All Microsoft.CodeAnalysis packages support .NET Framework 4.8

Co-authored-by: jzabroski <[email protected]>
Copilot AI changed the title [WIP] Update FluentMigrator.Analyzers.Tests to target net48 Add conditional net48 targeting to FluentMigrator.Analyzers.Tests Nov 19, 2025
Copilot AI requested a review from jzabroski November 19, 2025 17:26
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Test Results

    2 files  ±0      2 suites  ±0   34s ⏱️ -2s
5 344 tests ±0  5 012 ✅ ±0  332 💤 ±0  0 ❌ ±0 
5 825 runs  ±0  5 229 ✅ ±0  596 💤 ±0  0 ❌ ±0 

Results for commit 615872d. ± Comparison against base commit b09b979.

♻️ This comment has been updated with latest results.

Added a step to clean artifacts before the build process.
@jzabroski
Copy link
Collaborator

@copilot @PhenX The build is failing. I asked Google Gemini why, and this was the answer:

To use .NET Framework 4.8 (net48) with GitHub Actions on a windows-latest runner, which currently defaults to Windows Server 2025, you can define your workflow in a YAML file within the .github/workflows directory of your repository.
Here is an example workflow that builds a .NET Framework 4.8 project:

name: .NET Framework 4.8 Build

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v4

    - name: Setup MSBuild
      uses: microsoft/[email protected]

    - name: Restore NuGet packages
      run: nuget restore YourSolution.sln

    - name: Build project
      run: msbuild YourSolution.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Build /p:VisualStudioVersion=17.0

Explanation:

  • runs-on: windows-latest: This specifies that the job will run on the latest available Windows runner image, which is currently Windows Server 2025. This image comes with .NET Framework 4.8.1 pre-installed, ensuring compatibility with your net48 project.
  • actions/checkout@v4: This action checks out your repository's code onto the runner.
  • microsoft/[email protected]: This action sets up the MSBuild environment, which is necessary for building .NET Framework projects.
  • nuget restore YourSolution.sln: This step restores any NuGet packages required by your solution. Replace YourSolution.sln with the actual name of your solution file.
  • msbuild YourSolution.sln ...: This step uses MSBuild to compile your .NET Framework project. Adjust the solution file name and any specific MSBuild parameters (e.g., Configuration, Platform, VisualStudioVersion) as needed for your project. Note that VisualStudioVersion=17.0 corresponds to Visual Studio 2022, which is typically used for building projects targeting .NET Framework 4.8.

By following this structure, you can successfully build your .NET Framework 4.8 projects using the windows-latest GitHub Actions runner.

Copy link
Contributor Author

Copilot AI commented Nov 20, 2025

@copilot @PhenX The build is failing. I asked Google Gemini why, and this was the answer:

To use .NET Framework 4.8 (net48) with GitHub Actions on a windows-latest runner, which currently defaults...

Could you share the specific error message from the failing build? The current CI workflow uses dotnet test --framework net48 which should work on windows-latest runners (Windows Server 2025 includes .NET Framework 4.8.1).

The FluentMigrator.Tests project uses the same conditional targeting pattern and should work with the same approach. If there's a specific error with the Analyzers.Tests project, I can investigate further once I see the error message.

@jzabroski
Copy link
Collaborator

@copilot The build is failing on this error message: https://github.com/fluentmigrator/fluentmigrator/actions/runs/19543787130/job/55957118146?pr=2184#step:7:70

Error: C:\Program Files\dotnet\sdk\9.0.308\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\a\fluentmigrator\fluentmigrator\test\FluentMigrator.Analyzers.Tests\obj\project.assets.json' doesn't have a target for 'net48'. Ensure that restore has run and that you have included 'net48' in the TargetFrameworks for your project. [D:\a\fluentmigrator\fluentmigrator\test\FluentMigrator.Analyzers.Tests\FluentMigrator.Analyzers.Tests.csproj]

We think the issue is that windows-latest does not ship with the .NET Framework SDK required to build net48 TargetFramework. Hence the previous analysis by Google Gemini suggesting to add microsoft/[email protected], and why this works when running the build and test from Visual Studio 2022 November 2025 release.

- Install .NET Framework 4.8 Developer Pack on windows-latest runners
- Revert to combined restore/build/test step to let dotnet test handle framework-specific restore
- This fixes NETSDK1005 error when building net48 target on Windows Server 2025

Co-authored-by: jzabroski <[email protected]>
Copy link
Contributor Author

Copilot AI commented Nov 20, 2025

@copilot The build is failing on this error message: https://github.com/fluentmigrator/fluentmigrator/actions/runs/19543787130/job/55957118146?pr=2184#step:7:70

Error: C:\Program Files\dotnet\sdk...

Fixed in commit 615872d. The issue was that Windows Server 2025 (windows-latest) doesn't have the .NET Framework 4.8 Developer Pack installed by default, which is required for building net48 projects with .NET SDK 9.

The CI workflow now:

  1. Installs the .NET Framework 4.8 Developer Pack on Windows runners before building
  2. Uses dotnet test --framework net48 which handles framework-specific restore automatically

This should resolve the NETSDK1005 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should FluentMigrator.Analzyers.Tests also target net48?

2 participants