@@ -79,7 +79,8 @@ We use `GetProjectOptionsFromCommandLineArgs` to treat two files as a project:
7979
8080let projectOptions =
8181 let sysLib nm =
82- if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows
82+ if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then
83+ // file references only valid on Windows
8384 System.Environment.GetFolderPath( System.Environment.SpecialFolder.ProgramFilesX86) +
8485 @" \Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\" + nm + " .dll"
8586 else
@@ -88,7 +89,8 @@ let projectOptions =
8889 sysDir ++ nm + " .dll"
8990
9091 let fsCore4300 () =
91- if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows
92+ if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then
93+ // file references only valid on Windows
9294 System.Environment.GetFolderPath( System.Environment.SpecialFolder.ProgramFilesX86) +
9395 @" \Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll"
9496 else
@@ -159,7 +161,7 @@ let rec allSymbolsInEntities (entities: IList<FSharpEntity>) =
159161let allSymbols = allSymbolsInEntities wholeProjectResults.AssemblySignature.Entities
160162(**
161163After checking the whole project, you can access the background results for individual files
162- in the project. This will be fast and will not invlove any additional checking.
164+ in the project. This will be fast and will not involve any additional checking.
163165*)
164166
165167let backgroundParseResults1 , backgroundTypedParse1 =
@@ -307,8 +309,27 @@ correctly and then analyze each project in turn.
307309Cracking a project file
308310-----------------------------
309311
310- F# projects normally use the '.fsproj' project file format. You can get options corresponding to a project file
311- using GetProjectOptionsFromProjectFile. In this example we get the project options for one of the
312+ F# projects normally use the '.fsproj' project file format.
313+ A project cracking facility is provided as a separate NuGet package:
314+ FSharp.Compiler.Service.ProjectCracker. This NuGet package contains a
315+ library FSharp.Compiler.Service.ProjectCracker.dll, which should be
316+ referenced by your application directly, and an executable
317+ FSharp.Compiler.Service.ProjectCrackerTool.exe, which should be copied
318+ into the output folder of your application by the build process. This
319+ can be accomplished by adding lines to your `.fsproj` file similar to:
320+
321+ <Target Name="AfterBuild">
322+ <Copy SourceFiles="..\packages\FSharp.Compiler.Service.ProjectCracker\lib\net45\FSharp.Compiler.Service.ProjectCrackerTool.exe" DestinationFolder="$(OutputPath)" />
323+ <Copy SourceFiles="..\packages\FSharp.Compiler.Service.ProjectCracker\lib\net45\FSharp.Compiler.Service.ProjectCrackerTool.exe.config" DestinationFolder="$(OutputPath)" />
324+ </Target>
325+
326+ The reason for this split is so that the analysis of an F# project
327+ file is performed out of process, in order that the necessary assembly
328+ binding redirects can be applied without requiring the caller to
329+ arrange this. In this way MSBuild versions from 4 up to 14 can be
330+ accommodated transparently.
331+
332+ In this example we get the project options for one of the
312333project files in the F# Compiler Service project itself - you should also be able to use this technique
313334for any project that builds cleanly using the command line tools 'xbuild' or 'msbuild'.
314335
0 commit comments