diff --git a/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs b/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs index 2de1455018..f683ba185f 100644 --- a/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs +++ b/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs @@ -3,6 +3,7 @@ internal static class PropertyNames { public const string AllowUnsafeBlocks = nameof(AllowUnsafeBlocks); + public const string AlwaysCompileMarkupFilesInSeparateDomain = nameof(AlwaysCompileMarkupFilesInSeparateDomain); public const string AssemblyName = nameof(AssemblyName); public const string AssemblyOriginatorKeyFile = nameof(AssemblyOriginatorKeyFile); public const string BuildProjectReferences = nameof(BuildProjectReferences); diff --git a/src/OmniSharp.MSBuild/ProjectLoader.cs b/src/OmniSharp.MSBuild/ProjectLoader.cs index dd16de599c..907da5db9c 100644 --- a/src/OmniSharp.MSBuild/ProjectLoader.cs +++ b/src/OmniSharp.MSBuild/ProjectLoader.cs @@ -37,6 +37,13 @@ private static Dictionary CreateGlobalProperties( { PropertyNames._ResolveReferenceDependencies, "true" }, { PropertyNames.SolutionDir, solutionDirectory + Path.DirectorySeparatorChar }, + // Setting this property will cause any XAML markup compiler tasks to run in the + // current AppDomain, rather than creating a new one. This is important because + // our AppDomain.AssemblyResolve handler for MSBuild will not be connected to + // the XAML markup compiler's AppDomain, causing the task not to be able to find + // MSBuild. + { PropertyNames.AlwaysCompileMarkupFilesInSeparateDomain, "false" }, + // This properties allow the design-time build to handle the Compile target without actually invoking the compiler. // See https://github.com/dotnet/roslyn/pull/4604 for details. { PropertyNames.ProvideCommandLineArgs, "true" },