Fix Visual Studio project GUIDs getting randomized during regeneration
This commit is contained in:
@@ -55,7 +55,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void GenerateProject(Project project)
|
||||
public override void GenerateProject(Project project, string solutionPath)
|
||||
{
|
||||
var vcProjectFileContent = new StringBuilder();
|
||||
var vcFiltersFileContent = new StringBuilder();
|
||||
@@ -67,6 +67,13 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
var projectDirectory = Path.GetDirectoryName(project.Path);
|
||||
var filtersDirectory = project.SourceFolderPath;
|
||||
|
||||
// Try to reuse the existing project guid from existing files
|
||||
vsProject.ProjectGuid = GetProjectGuid(vsProject.Path, vsProject.Name);
|
||||
if (vsProject.ProjectGuid == Guid.Empty)
|
||||
vsProject.ProjectGuid = GetProjectGuid(solutionPath, vsProject.Name);
|
||||
if (vsProject.ProjectGuid == Guid.Empty)
|
||||
vsProject.ProjectGuid = Guid.NewGuid();
|
||||
|
||||
// Header
|
||||
vcProjectFileContent.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
|
||||
vcProjectFileContent.AppendLine(string.Format("<Project DefaultTargets=\"Build\" ToolsVersion=\"{0}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">", projectFileToolVersion));
|
||||
|
||||
Reference in New Issue
Block a user