Skip to content

Commit

Permalink
Simplyfy build
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed Dec 16, 2024
1 parent 528f42d commit f71d558
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions src/GUI/Shared/Helpers/SqlProjHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ public static async Task<string> BuildSqlProjAsync(string sqlprojPath)
return null;
}

var assemblyPath = await project.GetDacpacPathAsync();

var searchPath = Path.GetDirectoryName(assemblyPath);

if (string.IsNullOrEmpty(searchPath))
{
searchPath = Path.Combine(Path.GetDirectoryName(project.FullPath), "bin");
}

if (!await VS.Build.ProjectIsUpToDateAsync(project))
{
var ok = await VS.Build.BuildProjectAsync(project, BuildAction.Rebuild);
Expand All @@ -130,19 +121,11 @@ public static async Task<string> BuildSqlProjAsync(string sqlprojPath)
}
}

if (!Directory.Exists(searchPath))
{
return null;
}

var files = Directory.GetFiles(searchPath, "*.dacpac", SearchOption.AllDirectories)
.Where(f => !f.EndsWith("\\msdb.dacpac", StringComparison.OrdinalIgnoreCase)
&& !f.EndsWith("\\master.dacpac", StringComparison.OrdinalIgnoreCase))
.ToList();
var dacpacPath = await project.GetDacpacPathAsync();

if (files.Count == 1)
if (!string.IsNullOrEmpty(dacpacPath))
{
return files[0];
return dacpacPath;
}

throw new InvalidOperationException("Dacpac build failed, please pick the file manually");
Expand Down

0 comments on commit f71d558

Please sign in to comment.