Skip to content

Commit 342a6d2

Browse files
auduchinokvzarytovskiiKevinRansom
authored
Fix FSharp.Core references in FCS solution (#13827)
* Allow using FSharp.Core package in new service solution projects * Remove inner rules * Another FSharp.Core reference * Fix relative path Co-authored-by: Vlad Zarytovskii <[email protected]> Co-authored-by: Kevin Ransom (msft) <[email protected]>
1 parent 51635bb commit 342a6d2

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

Directory.Build.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
<Import Project="FSharpBuild.Directory.Build.props" Condition = " '$(FSharpTestCompilerVersion)' == '' "/>
44
<Import Project="FSharpTests.Directory.Build.props" Condition = " '$(FSharpTestCompilerVersion)' != '' "/>
55

6+
<!--
7+
When developers load the FSharp.Compiler.Service solution we set FSHARPCORE_USE_PACKAGE to true if it hasn't already been set to a value.
8+
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local
9+
FSharp.Core project.
10+
-->
11+
<PropertyGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">
12+
<FSHARPCORE_USE_PACKAGE Condition="'$(SolutionName)' == 'FSharp.Compiler.Service'">true</FSHARPCORE_USE_PACKAGE>
13+
</PropertyGroup>
14+
615
<ItemGroup>
716
<!-- If there is a README.md next to a project file, include it (for easier access in the IDE) -->
817
<None Include="README.md" Condition="Exists('README.md')" />

src/Directory.Build.props

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
44

5-
<!--
6-
When developers load the FSharp.Compiler.Service solution we set FSHARPCORE_USE_PACKAGE to true if it hasn't already been set to a value.
7-
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local
8-
FSharp.Core project.
9-
-->
10-
<PropertyGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">
11-
<FSHARPCORE_USE_PACKAGE Condition="'$(SolutionName)' == 'FSharp.Compiler.Service'">true</FSHARPCORE_USE_PACKAGE>
12-
</PropertyGroup>
13-
145
<PropertyGroup>
156
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
167
<UseStandardResourceNames>false</UseStandardResourceNames>

tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,15 @@
213213
<ItemGroup>
214214
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj" />
215215
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj" />
216-
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Core\FSharp.Core.fsproj" />
217216
<ProjectReference Include="$(FSharpTestsRoot)\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj" />
218217
</ItemGroup>
219218

219+
<ItemGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' != 'true'">
220+
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Core\FSharp.Core.fsproj" />
221+
</ItemGroup>
222+
223+
<ItemGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">
224+
<PackageReference Include="FSharp.Core" Version="$(FSharpCoreShippedPackageVersionValue)" />
225+
</ItemGroup>
226+
220227
</Project>

tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,23 @@
4040
<!-- Reference a project -->
4141
<ItemGroup Condition="'$(FcsReferenceType)' == 'project'">
4242
<ProjectReference Include="$(FcsProjectPath)" />
43-
<ProjectReference Include="..\..\..\..\src\FSharp.Core\FSharp.Core.fsproj" />
4443
</ItemGroup>
4544
<!-- Reference the FCS NuGet package with the specified $FcsVersion, use locally built FSharp.Core
4645
Arguably this could be changed to depend on the version of FSharp.Core that's pulled in via FSharp.Compiler.Service.
4746
Keeping the old behaviour for now
4847
-->
4948
<ItemGroup Condition=" '$(FcsReferenceType)' == 'nuget' ">
5049
<PackageReference Include="FSharp.Compiler.Service" Version="$(FcsNuGetVersion)" />
50+
</ItemGroup>
51+
52+
<ItemGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' != 'true'">
5153
<ProjectReference Include="..\..\..\..\src\FSharp.Core\FSharp.Core.fsproj" />
5254
</ItemGroup>
55+
56+
<ItemGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">
57+
<PackageReference Include="FSharp.Core" Version="$(FSharpCoreShippedPackageVersionValue)" />
58+
</ItemGroup>
59+
5360
<!-- Reference the dlls specified in $FcsDllPath and $FSharpCoreDllPath -->
5461
<ItemGroup Condition=" '$(FcsReferenceType)' == 'dll' ">
5562
<Reference Include="FSharp.Compiler.Service">

tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@
2727

2828
<ItemGroup>
2929
<ProjectReference Include="..\..\..\..\src\Compiler\FSharp.Compiler.Service.fsproj" />
30-
<ProjectReference Include="..\..\..\..\src\FSharp.Core\FSharp.Core.fsproj" />
3130
<ProjectReference Include="..\BenchmarkComparison\HistoricalBenchmark.fsproj" />
3231
</ItemGroup>
3332

33+
<ItemGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' != 'true'">
34+
<ProjectReference Include="..\..\..\..\src\FSharp.Core\FSharp.Core.fsproj" />
35+
</ItemGroup>
36+
37+
<ItemGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">
38+
<PackageReference Include="FSharp.Core" Version="$(FSharpCoreShippedPackageVersionValue)" />
39+
</ItemGroup>
40+
3441
</Project>

0 commit comments

Comments
 (0)