Fix Visual Studio project GUIDs getting randomized during regeneration

This commit is contained in:
2023-09-27 20:16:46 +03:00
parent 0c00dc20a2
commit 22e5afdb6f
10 changed files with 59 additions and 41 deletions

View File

@@ -26,7 +26,7 @@ namespace Flax.Build.Projects.VisualStudio
public override TargetType? Type => TargetType.DotNetCore;
/// <inheritdoc />
public override void GenerateProject(Project project)
public override void GenerateProject(Project project, string solutionPath)
{
var csProjectFileContent = new StringBuilder();
@@ -53,6 +53,11 @@ namespace Flax.Build.Projects.VisualStudio
}
}
// Try to reuse the existing project guid from solution file
vsProject.ProjectGuid = GetProjectGuid(solutionPath, vsProject.Name);
if (vsProject.ProjectGuid == Guid.Empty)
vsProject.ProjectGuid = Guid.NewGuid();
// Header
csProjectFileContent.AppendLine("<Project Sdk=\"Microsoft.NET.Sdk\">");
csProjectFileContent.AppendLine("");