|
4 | 4 | <OutputType>Library</OutputType> |
5 | 5 | <TargetFramework>netstandard2.0</TargetFramework> |
6 | 6 | <GenerateDocumentationFile>true</GenerateDocumentationFile> |
7 | | - <FSharpToolsDirectory>typeproviders</FSharpToolsDirectory> |
8 | | - <PackagePath>typeproviders</PackagePath> |
9 | 7 |
|
10 | 8 | <Description>FSharp implementation of Facebook GraphQL query language (Client)</Description> |
11 | | - <NoWarn>$(NoWarn);NU5100</NoWarn> |
12 | 9 | </PropertyGroup> |
13 | 10 |
|
| 11 | + <!-- Include the DesignTime DLL into the package alongside the runtime DLL. |
| 12 | + The F# compiler searches for the DesignTime DLL in the same directory as the runtime DLL. |
| 13 | +
|
| 14 | + The standard SDK mechanism (PackageFSharpDesignTimeTools via IsFSharpDesignTimeProvider) does not |
| 15 | + work here for the "runtime project references designtime via ProjectReference" pattern. |
| 16 | +
|
| 17 | + Root cause: dotnet pack invokes the project a second time with BuildProjectReferences=false |
| 18 | + to collect package content (_GetTfmSpecificContentForPackage). This flag prevents MSBuild from |
| 19 | + running ResolveProjectReferences, so _ResolvedProjectReferencePaths is empty in that inner context. |
| 20 | + PackageFSharpDesignTimeTools reads _ResolvedProjectReferencePaths to find the DesignTime DLL — |
| 21 | + and finds nothing. |
| 22 | +
|
| 23 | + This is a known MSBuild/F# SDK limitation. Relevant references: |
| 24 | + - dotnet/fsharp#18924 PackageFSharpDesignTimeTools target interacts unpredictably with the build |
| 25 | + https://github.com/dotnet/fsharp/issues/18924 |
| 26 | + - dotnet/fsharp#18929 Fix early/unconditional execution of PackageFSharpDesignTimeTools (merged |
| 27 | + Oct 2025, SDK 10.0.301) — fixes the direct IsFSharpDesignTimeProvider=true |
| 28 | + case but explicitly does NOT fix the ProjectReference case due to MSBuild |
| 29 | + evaluation-phase constraints |
| 30 | + https://github.com/dotnet/fsharp/pull/18929 |
| 31 | + - dotnet/fsharp#12320 NETSDK1085 when packing with `no-build` |
| 32 | + https://github.com/dotnet/fsharp/issues/12320 |
| 33 | +
|
| 34 | + Workaround: hook into TargetsForTfmSpecificContentInPackage at evaluation time (PropertyGroup), |
| 35 | + then use GetTargetPath to resolve the DesignTime DLL path without triggering a build, and inject |
| 36 | + it directly as a TfmSpecificPackageFile. --> |
| 37 | + <PropertyGroup Condition="'$(IsNuGet)' != ''"> |
| 38 | + <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_IncludeDesignTimeDllInPackage</TargetsForTfmSpecificContentInPackage> |
| 39 | + </PropertyGroup> |
| 40 | + |
| 41 | + <Target Name="_IncludeDesignTimeDllInPackage" Condition="'$(IsNuGet)' != ''"> |
| 42 | + <ItemGroup> |
| 43 | + <_DesignTimeProjectRef Include="@(ProjectReference)" |
| 44 | + Condition="'%(ProjectReference.IsFSharpDesignTimeProvider)' == 'true'" /> |
| 45 | + </ItemGroup> |
| 46 | + <MSBuild Projects="@(_DesignTimeProjectRef)" |
| 47 | + Targets="GetTargetPath" |
| 48 | + Properties="Configuration=$(Configuration);TargetFramework=netstandard2.0"> |
| 49 | + <Output TaskParameter="TargetOutputs" ItemName="_DesignTimeDllPath" /> |
| 50 | + </MSBuild> |
| 51 | + <ItemGroup> |
| 52 | + <TfmSpecificPackageFile Include="@(_DesignTimeDllPath)"> |
| 53 | + <PackagePath>lib/netstandard2.0</PackagePath> |
| 54 | + </TfmSpecificPackageFile> |
| 55 | + </ItemGroup> |
| 56 | + </Target> |
| 57 | + |
14 | 58 | <ItemGroup> |
15 | 59 | <PackageReference Update="FSharp.Core" VersionOverride="$(FSharpCoreVersion)"> |
16 | 60 | <PrivateAssets>all</PrivateAssets> |
|
36 | 80 | <Compile Include="GraphQLProvider.Runtime.fs" /> |
37 | 81 | </ItemGroup> |
38 | 82 |
|
39 | | - <Target Name="RemoveUnnecessaryNuGetPackInput" BeforeTargets="GenerateNuspec"> |
40 | | - <ItemGroup> |
41 | | - <FSharpCoreNuGetPackInput Include="@(NuGetPackInput)" Condition="$([System.String]::Copy( %(FullPath) ).EndsWith('FSharp.Core.resources.dll'))" /> |
42 | | - <PdbNuGetPackInput Include="@(NuGetPackInput)" Condition="$([System.String]::Copy( %(FullPath) ).Contains('DesignTime')) And ('%(Extension)' == '.pdb' OR '%(Extension)' == '.xml')" /> |
43 | | - </ItemGroup> |
44 | | - <ItemGroup> |
45 | | - <NuGetPackInput Remove="@(FSharpCoreNuGetPackInput)" /> |
46 | | - <NuGetPackInput Remove="@(PdbNuGetPackInput)" /> |
47 | | - <_PackageFiles Remove="@(FSharpCoreNuGetPackInput)" /> |
48 | | - <_PackageFiles Remove="@(PdbNuGetPackInput)" /> |
49 | | - </ItemGroup> |
50 | | - </Target> |
51 | | - |
52 | 83 | <ItemGroup> |
53 | | - <ProjectReference Condition="$(IsNuGet) != ''" Include="..\FSharp.Data.GraphQL.Client.DesignTime\FSharp.Data.GraphQL.Client.DesignTime.fsproj"> |
| 84 | + <ProjectReference Condition="'$(IsNuGet)' != ''" Include="..\FSharp.Data.GraphQL.Client.DesignTime\FSharp.Data.GraphQL.Client.DesignTime.fsproj"> |
54 | 85 | <IsFSharpDesignTimeProvider>true</IsFSharpDesignTimeProvider> |
55 | 86 | <PrivateAssets>all</PrivateAssets> |
56 | 87 | </ProjectReference> |
57 | | - <PackageReference Condition="$(IsNuGet) != ''" Include="FSharp.Data.GraphQL.Shared" VersionOverride="$(Version)" /> |
58 | | - <ProjectReference Condition="$(IsNuGet) == ''" Include="..\FSharp.Data.GraphQL.Shared\FSharp.Data.GraphQL.Shared.fsproj" /> |
| 88 | + <PackageReference Condition="'$(IsNuGet)' != ''" Include="FSharp.Data.GraphQL.Shared" VersionOverride="$(Version)" /> |
| 89 | + <ProjectReference Condition="'$(IsNuGet)' == ''" Include="..\FSharp.Data.GraphQL.Shared\FSharp.Data.GraphQL.Shared.fsproj" /> |
59 | 90 | </ItemGroup> |
60 | 91 | </Project> |
0 commit comments