Skip to content
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

Allow loading of projects that are missing imports. #206

Merged
merged 12 commits into from
Apr 21, 2024
11 changes: 7 additions & 4 deletions src/Ionide.ProjInfo/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ module ProjectLoader =
and set (v: LoggerVerbosity): unit = ()
}


let internal stringWriterLogger (writer: StringWriter) =
{ new ILogger with
member this.Initialize(eventSource: IEventSource) : unit =
Expand Down Expand Up @@ -530,14 +529,17 @@ module ProjectLoader =
let globalProperties = getGlobalProps path tfm globalProperties

use pc = new ProjectCollection(globalProperties)

let pi = pc.LoadProject(path, globalProperties, toolsVersion = null)
let loadSettings =
ProjectLoadSettings.RecordEvaluatedItemElements
||| ProjectLoadSettings.ProfileEvaluation
||| ProjectLoadSettings.IgnoreMissingImports
let project = Project(projectFile = path, globalProperties = globalProperties, toolsVersion = null, projectCollection = pc, loadSettings = loadSettings)

use sw = new StringWriter()

let loggers = createLoggers [ path ] binaryLogs sw

let pi = pi.CreateProjectInstance()
let pi = project.CreateProjectInstance()

let build = pi.Build(designTimeBuildTargets isLegacyFrameworkProjFile, loggers)

Expand Down Expand Up @@ -1030,6 +1032,7 @@ type WorkspaceLoaderViaProjectGraph private (toolsPath, ?globalProperties: (stri
buildParameters.ProjectLoadSettings <-
ProjectLoadSettings.RecordEvaluatedItemElements
||| ProjectLoadSettings.ProfileEvaluation
||| ProjectLoadSettings.IgnoreMissingImports

buildParameters.LogInitialPropertiesAndItems <- true
bm.BeginBuild(buildParameters)
Expand Down
Loading