Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth out potential issues using ResetDevSite #5310

Merged
merged 2 commits into from
Sep 22, 2022
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
5 changes: 5 additions & 0 deletions Build/Tasks/CopyWebConfigToDevSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public sealed class CopyWebConfigToDevSite : FrostingTask<Context>
/// <inheritdoc/>
public override void Run(Context context)
{
if (string.IsNullOrWhiteSpace(context.Settings.DnnConnectionString))
{
throw new InvalidOperationException("DnnConnectionString was blank and must have a value when the CopyWebConfigToDevSite task is run");
}

var conf = context.FileReadText("./Website/web.config");
var transFile = "./Build/Tasks/webconfig-transform.local.xsl";
if (!context.FileExists(transFile))
Expand Down
7 changes: 6 additions & 1 deletion Build/Tasks/ResetDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace DotNetNuke.Build.Tasks
{
using System;
using System.Data.SqlClient;
using System.IO;
using System.Linq;

using Cake.Common.Diagnostics;
Expand Down Expand Up @@ -46,8 +47,12 @@ private static string LoadScript(ICakeContext context, string scriptName)

private static string ReplaceScriptVariables(Context context, string script)
{
var dbPath = context.FileSystem.GetDirectory(context.Settings.DatabasePath);
dbPath.Create();
var fullDbPath = Path.GetFullPath(dbPath.Path.FullPath);

return script.Replace("{DBName}", context.Settings.DnnDatabaseName)
.Replace("{DBPath}", context.Settings.DatabasePath)
.Replace("{DBPath}", fullDbPath)
.Replace("{DBLogin}", context.Settings.DnnSqlUsername);
}

Expand Down