-
Notifications
You must be signed in to change notification settings - Fork 833
Fix early/unconditional execution of PackageFSharpDesignTimeTools target #18929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
T-Gro
merged 22 commits into
main
from
copilot/fix-33b8588e-1397-4c1b-b736-aca6613b4743
Oct 22, 2025
Merged
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a8faf04
Initial plan
Copilot e7f6473
Fix early/unconditional execution of PackageFSharpDesignTimeTools target
Copilot 9388b94
Refine PackageFSharpDesignTimeTools gating logic following implementa…
Copilot 7ceda87
Address feedback - simplify implementation and add comprehensive end-…
Copilot 99f3428
Implement requested functionality with MSBuild-compliant approach
Copilot 2d410dd
Integrate DesignTimeProviderPackaging tests into CI EndToEndBuildTest…
Copilot 387c51a
Merge branch 'main' into copilot/fix-33b8588e-1397-4c1b-b736-aca6613b…
T-Gro 2c5c681
Fix duplicate TargetsForTfmSpecificContentInPackage entries when both…
Copilot f8c67b1
Add issue repro test case for NETSDK1085 with pack --no-build scenario
Copilot c0c6e5a
Fix: Set TargetsForTfmSpecificContentInPackage at evaluation time, no…
Copilot 573839b
Add back target-based reference checking to test MSBuild behavior
Copilot ecfd7a4
Merge branch 'main' into copilot/fix-33b8588e-1397-4c1b-b736-aca6613b…
T-Gro 7279411
Merge branch 'main' into copilot/fix-33b8588e-1397-4c1b-b736-aca6613b…
T-Gro 2365563
UseDotNet for e2e tests
T-Gro 27d0ee9
Remove Test 6 (issue repro) - doesn't test our changes
Copilot 954d794
Improve EndToEndBuildTests diagnostics with detailed error messages
Copilot 829efd7
Add FSharpTestCompilerVersion parameter to all pack commands
Copilot 7f234b9
Fix double-import issue breaking F# SDK targets in EndToEndBuildTests
Copilot fe68810
Simplify DesignTimeProviderPackaging tests - build+pack pattern like …
Copilot b4e4d57
Remove binlog target checking from tests - only verify package contents
Copilot 05aae53
Apply suggestion from @T-Gro
T-Gro 810014c
Apply suggestion from @T-Gro
T-Gro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/EndToEndBuildTests/DesignTimeProviderPackaging/Host/Host.fsproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="Library.fs" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Provider\Provider.fsproj"> | ||
| <IsFSharpDesignTimeProvider>true</IsFSharpDesignTimeProvider> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| </ProjectReference> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
4 changes: 4 additions & 0 deletions
4
tests/EndToEndBuildTests/DesignTimeProviderPackaging/Host/Library.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| namespace Host | ||
|
|
||
| module Library = | ||
| let hostFunc name = sprintf "Host says hello %s" name |
4 changes: 4 additions & 0 deletions
4
tests/EndToEndBuildTests/DesignTimeProviderPackaging/PlainLib/Library.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| namespace PlainLib | ||
|
|
||
| module Library = | ||
| let hello name = sprintf "Hello %s" name |
13 changes: 13 additions & 0 deletions
13
tests/EndToEndBuildTests/DesignTimeProviderPackaging/PlainLib/PlainLib.fsproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="Library.fs" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
4 changes: 4 additions & 0 deletions
4
tests/EndToEndBuildTests/DesignTimeProviderPackaging/Provider/Library.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| namespace Provider | ||
|
|
||
| module Library = | ||
| let providerFunc name = sprintf "Provider says hello %s" name |
14 changes: 14 additions & 0 deletions
14
tests/EndToEndBuildTests/DesignTimeProviderPackaging/Provider/Provider.fsproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion> | ||
| <IsFSharpDesignTimeProvider>true</IsFSharpDesignTimeProvider> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="Library.fs" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
4 changes: 4 additions & 0 deletions
4
tests/EndToEndBuildTests/DesignTimeProviderPackaging/RedirectLib/Library.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| namespace RedirectLib | ||
|
|
||
| module Library = | ||
| let redirectFunc name = sprintf "RedirectLib says hello %s" name |
14 changes: 14 additions & 0 deletions
14
tests/EndToEndBuildTests/DesignTimeProviderPackaging/RedirectLib/RedirectLib.fsproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net472</TargetFramework> | ||
| <FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion> | ||
| <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="Library.fs" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
138 changes: 138 additions & 0 deletions
138
tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| @echo off | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| rem | ||
| rem End to end tests for DesignTimeProviderPackaging | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rem Tests the conditional inclusion of PackageFSharpDesignTimeTools target | ||
| rem | ||
|
|
||
| setlocal | ||
| set __scriptpath=%~dp0 | ||
| set configuration=Debug | ||
|
|
||
| :parseargs | ||
| if "%1" == "" goto argsdone | ||
| if /i "%1" == "-c" goto set_configuration | ||
|
|
||
| echo Unsupported argument: %1 | ||
| goto failure | ||
|
|
||
| :set_configuration | ||
| set configuration=%2 | ||
| shift | ||
| shift | ||
| goto parseargs | ||
|
|
||
| :argsdone | ||
|
|
||
| pushd %__scriptpath% | ||
|
|
||
| rem Clean artifacts | ||
| if exist artifacts rd artifacts /s /q | ||
| mkdir artifacts | ||
|
|
||
| echo. | ||
| echo === Test 1: Plain Library (No Provider) === | ||
| echo dotnet pack PlainLib\PlainLib.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\plain.binlog | ||
| dotnet pack PlainLib\PlainLib.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\plain.binlog | ||
| if ERRORLEVEL 1 echo Error: Plain library pack failed && goto :failure | ||
|
|
||
| rem Check that PackageFSharpDesignTimeTools target did not run | ||
| findstr /C:"PackageFSharpDesignTimeTools" %~dp0artifacts\plain.binlog >nul 2>&1 | ||
| if not ERRORLEVEL 1 echo Error: PackageFSharpDesignTimeTools target should not have run for plain library && goto :failure | ||
|
|
||
| rem Check that no tools folder exists in nupkg | ||
| powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem; $zip = [System.IO.Compression.ZipFile]::OpenRead('%~dp0artifacts\PlainLib.1.0.0.nupkg'); $hasTools = $zip.Entries | Where-Object { $_.FullName -like 'tools/fsharp41/*' }; if ($hasTools) { exit 1 } else { exit 0 } }" | ||
| if ERRORLEVEL 1 echo Error: Plain library should not contain tools/fsharp41 folder && goto :failure | ||
|
|
||
| echo Plain library test passed | ||
|
|
||
| echo. | ||
| echo === Test 2: Provider Project (Direct Flag) === | ||
| echo dotnet pack Provider\Provider.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\provider.binlog | ||
| dotnet pack Provider\Provider.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\provider.binlog | ||
| if ERRORLEVEL 1 echo Error: Provider pack failed && goto :failure | ||
|
|
||
| rem Check that PackageFSharpDesignTimeTools target ran | ||
| findstr /C:"PackageFSharpDesignTimeTools" %~dp0artifacts\provider.binlog >nul 2>&1 | ||
| if ERRORLEVEL 1 echo Error: PackageFSharpDesignTimeTools target should have run for provider && goto :failure | ||
|
|
||
| rem Check that tools folder exists in nupkg | ||
| powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem; $zip = [System.IO.Compression.ZipFile]::OpenRead('%~dp0artifacts\Provider.1.0.0.nupkg'); $hasTools = $zip.Entries | Where-Object { $_.FullName -like 'tools/fsharp41/*' }; if ($hasTools) { exit 0 } else { exit 1 } }" | ||
| if ERRORLEVEL 1 echo Error: Provider should contain tools/fsharp41 folder && goto :failure | ||
|
|
||
| echo Provider test passed | ||
|
|
||
| echo. | ||
| echo === Test 3: Host with ProjectReference to Provider === | ||
| echo dotnet pack Host\Host.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\host.binlog | ||
| dotnet pack Host\Host.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\host.binlog | ||
| if ERRORLEVEL 1 echo Error: Host pack failed && goto :failure | ||
|
|
||
| rem Note: This test may not work as expected due to MSBuild evaluation phase limitations | ||
| rem The current implementation only checks IsFSharpDesignTimeProvider property directly | ||
| echo Host test completed (implementation limitation noted) | ||
|
|
||
| echo. | ||
| echo === Test 4: Pack with --no-build (No Provider) === | ||
| echo dotnet build PlainLib\PlainLib.fsproj -c %configuration% | ||
| dotnet build PlainLib\PlainLib.fsproj -c %configuration% | ||
| if ERRORLEVEL 1 echo Error: Plain library build failed && goto :failure | ||
|
|
||
| echo dotnet pack PlainLib\PlainLib.fsproj --no-build -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\nobuild.binlog | ||
| dotnet pack PlainLib\PlainLib.fsproj --no-build -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\nobuild.binlog | ||
| if ERRORLEVEL 1 echo Error: Plain library pack --no-build failed && goto :failure | ||
|
|
||
| echo No-build test passed | ||
|
|
||
| echo. | ||
| echo === Test 5: Binding Redirect / App.config Interaction === | ||
| echo dotnet pack RedirectLib\RedirectLib.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\redirect.binlog | ||
| dotnet pack RedirectLib\RedirectLib.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\redirect.binlog | ||
| if ERRORLEVEL 1 echo Error: RedirectLib pack failed && goto :failure | ||
|
|
||
| rem Check that PackageFSharpDesignTimeTools target did not run | ||
| findstr /C:"PackageFSharpDesignTimeTools" %~dp0artifacts\redirect.binlog >nul 2>&1 | ||
| if not ERRORLEVEL 1 echo Error: PackageFSharpDesignTimeTools target should not have run for redirect library && goto :failure | ||
|
|
||
| echo Redirect test passed | ||
|
|
||
| echo. | ||
| echo === Test 6: Issue Repro - Simple project with reference and pack --no-build === | ||
| pushd artifacts | ||
| echo Creating eff project... | ||
| dotnet new classlib --language F# --name eff -o eff | ||
| if ERRORLEVEL 1 echo Error: Failed to create eff project && popd && goto :failure | ||
|
|
||
| echo Creating gee project... | ||
| dotnet new classlib --language F# --name gee -o gee | ||
| if ERRORLEVEL 1 echo Error: Failed to create gee project && popd && goto :failure | ||
|
|
||
| echo Adding reference from gee to eff... | ||
| dotnet add gee/gee.fsproj reference eff/eff.fsproj | ||
| if ERRORLEVEL 1 echo Error: Failed to add reference && popd && goto :failure | ||
|
|
||
| echo Building gee project... | ||
| dotnet build gee/gee.fsproj | ||
| if ERRORLEVEL 1 echo Error: Failed to build gee project && popd && goto :failure | ||
|
|
||
| echo Packing gee project with --no-build... | ||
| dotnet pack gee/gee.fsproj --no-build | ||
| if ERRORLEVEL 1 echo Error: Pack --no-build failed (NETSDK1085) && popd && goto :failure | ||
|
|
||
| popd | ||
|
|
||
| echo Issue repro test passed | ||
|
|
||
| :success | ||
| endlocal | ||
| echo. | ||
| echo === All DesignTimeProviderPackaging tests PASSED === | ||
| popd | ||
| exit /b 0 | ||
|
|
||
| :failure | ||
| endlocal | ||
| echo. | ||
| echo === DesignTimeProviderPackaging tests FAILED === | ||
| popd | ||
| exit /b 1 | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.