Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>14.3.0</VersionPrefix>
<VersionPrefix>14.3.1</VersionPrefix>

<Authors>Rico Suter</Authors>
<Copyright>Copyright © Rico Suter, 2023</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ public static async Task<ProjectMetadata> GetProjectMetadata(

var args = CreateMsBuildArguments(file, framework, configuration, runtime, noBuild, outputPath);

var metadata = await TryReadingUsingGetProperties(args, file, noBuild) ?? await ReadUsingMsBuildTargets(args, file, buildExtensionsDir, console);
var metadata = await TryReadingUsingGetProperties(args, file, noBuild);
if (metadata == null || string.IsNullOrWhiteSpace(metadata[nameof(ProjectDir)]))
{
metadata = await ReadUsingMsBuildTargets(args, file, buildExtensionsDir, console);
}

var platformTarget = metadata[nameof(PlatformTarget)];
if (platformTarget.Length == 0)
Expand Down Expand Up @@ -225,7 +229,8 @@ private static async Task<Dictionary<string, string>> TryReadingUsingGetProperti
nameof(ProjectDir),
nameof(ProjectRuntimeConfigFilePath),
nameof(TargetFileName),
nameof(TargetFrameworkIdentifier)
nameof(TargetFrameworkIdentifier),
"MSBuildProjectDirectory",
};

try
Expand All @@ -251,6 +256,12 @@ private static async Task<Dictionary<string, string>> TryReadingUsingGetProperti
.EnumerateObject()
.ToDictionary(x => x.Name, x => x.Value.ToString().Trim());

// depending on the project type or MSBuild evaluation process, the ProjectDir property may not be set
if (string.IsNullOrWhiteSpace(metadata[nameof(ProjectDir)]))
{
metadata[nameof(ProjectDir)] = metadata["MSBuildProjectDirectory"];
}

return metadata;
}
}
Expand Down
Loading