From 659baa7d731ff3200d8c4f2628a236fc52cf7d5e Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 13 Jan 2021 11:08:33 -0800 Subject: [PATCH] Handle project evaluation target path with spaces (#891) --- src/Microsoft.Tye.Core/ApplicationFactory.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Tye.Core/ApplicationFactory.cs b/src/Microsoft.Tye.Core/ApplicationFactory.cs index 4b9beeea..37e91af5 100644 --- a/src/Microsoft.Tye.Core/ApplicationFactory.cs +++ b/src/Microsoft.Tye.Core/ApplicationFactory.cs @@ -516,16 +516,17 @@ namespace Microsoft.Tye output.WriteDebugLine("Restoring and evaluating projects"); + var projectEvaluationTargets = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "ProjectEvaluation.targets"); var msbuildEvaluationResult = await ProcessUtil.RunAsync( "dotnet", $"build " + $"\"{projectPath}\" " + // CustomAfterMicrosoftCommonTargets is imported by non-crosstargeting (single TFM) projects - $"/p:CustomAfterMicrosoftCommonTargets={Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "ProjectEvaluation.targets")} " + + @$"/p:CustomAfterMicrosoftCommonTargets=""{projectEvaluationTargets}"" " + // CustomAfterMicrosoftCommonCrossTargetingTargets is imported by crosstargeting (multi-TFM) projects // This ensures projects properties are evaluated correctly. However, multi-TFM projects must specify // a specific TFM to build/run/publish and will otherwise throw an exception. - $"/p:CustomAfterMicrosoftCommonCrossTargetingTargets={Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "ProjectEvaluation.targets")} " + + @$"/p:CustomAfterMicrosoftCommonCrossTargetingTargets=""{projectEvaluationTargets}"" " + $"/nologo", throwOnError: false, workingDirectory: directory.DirectoryPath);