MSBuild evaluation, fsproj file loading, and project system for F# tooling


Keywords
FsProj, MSBuild, SDK, dotnet, csproj, dotnet-cli, dotnet-core, fsharp, vbproj
License
MIT
Install
Install-Package Ionide.ProjInfo -Version 0.63.0

Documentation

Ionide.ProjInfo

NuGet GitHub Workflow Status

Parsing and evaluating of .fsproj files. This repository contains several packages:

  • Ionide.ProjInfo - library for parsing and evaluating .fsproj files, using Microsoft.Build libraries
  • Ionide.ProjInfo.Sln - library for parsing .sln files
  • Ionide.ProjInfo.FCS - library providing utility for mapping project data types used by Ionide.ProjInfo into FSharpProjectOptions type used by FSharp.Compiler.Service
  • Ionide.ProjInfo.ProjectSystem - library providing high level project system component that can be used by editor tooling. It supports features like tracking changes, event-driven notifications about project loading status, and persistent caching of the data for fast initial load.
  • Ionide.ProjInfo.Tool - a CLI tool intended to help with debugging the cracking of various projects easily

You can support Ionide development on Open Collective.

Open Collective


Used by:

Deprecated

  • as .NET Core Tool: NuGet
  • as dotnet cli tool: dotnet proj-info NuGet.
  • old libraries (Dotnet.ProjInfo.*): NuGet

Getting started

This project loads some MSBuild specific assemblies at runtime. Somewhat similar to how MSBuildLocator loads the correct assemblies. Because of this you need to add a direct dependency on Microsoft.Build.Framework and NuGet.Frameworks but keep excluded them at runtime.

<PackageReference Include="Microsoft.Build.Framework" Version="17.2.0" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageReference Include="NuGet.Frameworks" Version="6.2.1" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageReference Include="Ionide.ProjInfo" Version="0.59.2" />

Next, you first need to initialize the MsBuild integration.

open Ionide.ProjInfo

let projectDirectory: DirectoryInfo = yourProjectOrSolutionFolder
let toolsPath = Init.init projectDirectory None

With the toolsPath you can create a loader

let defaultLoader: IWorkspaceLoader = WorkspaceLoader.Create(toolsPath, [])
// or
let graphLoader: IWorkspaceLoader = WorkspaceLoaderViaProjectGraph.Create(toolsPath, [])

Using the IWorkspaceLoader you can load projects or solutions. Events are being emitted while projects/solutions are loaded. You typically want to subscribe to this before you load anything.

let subscription: System.IDisposable = defaultLoader.Notifications.Subscribe(fun msg -> printfn "%A" msg)
let projectOptions = loader.LoadProjects([ yourFsProjPath ]) |> Seq.toArray

How to contribute

Imposter syndrome disclaimer: I want your help. No really, I do.

There might be a little voice inside that tells you you're not ready; that you need to do one more tutorial, or learn another framework, or write a few more blog posts before you can help me with this project.

I assure you, that's not the case.

This project has some clear Contribution Guidelines and expectations that you can read here.

The contribution guidelines outline the process that you'll need to follow to get a patch merged. By making expectations and process explicit, I hope it will make it easier for you to contribute.

And you don't just have to write code. You can help out by writing documentation, tests, or even by giving feedback about this work. (And yes, that includes giving feedback about the contribution guidelines.)

Thank you for contributing!

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests.

The library is available under MIT license, which allows modification and redistribution for both commercial and non-commercial purposes.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.