Browse Source
Fixes 'No migrations configuration type was found in the assembly' error when enabling migrations. EntityFramework's Enable-Migrations cmdlet builds the project and then checks the generated assembly for the configurations class that it added. Enable-Migrations now works.pull/28/head
10 changed files with 224 additions and 6 deletions
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.PackageManagement.Design |
||||
{ |
||||
public class FakeProjectBuilder : IProjectBuilder |
||||
{ |
||||
public FakeProjectBuilder() |
||||
{ |
||||
BuildResults = new BuildResults(); |
||||
} |
||||
|
||||
public IProject ProjectPassedToBuild; |
||||
|
||||
public BuildResults BuildResults { get; set; } |
||||
|
||||
public void Build(IProject project) |
||||
{ |
||||
ProjectPassedToBuild = project; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public interface IProjectBuilder |
||||
{ |
||||
BuildResults BuildResults { get; } |
||||
|
||||
/// <summary>
|
||||
/// Builds the project and waits for the build to complete.
|
||||
/// </summary>
|
||||
void Build(IProject project); |
||||
} |
||||
} |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using System.Threading; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Project.Commands; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public class ProjectBuilder : IProjectBuilder |
||||
{ |
||||
ManualResetEvent buildCompleteEvent = new ManualResetEvent(false); |
||||
TimeSpan DefaultBuildTimeout = new TimeSpan(0, 5, 0); |
||||
|
||||
public ProjectBuilder() |
||||
{ |
||||
} |
||||
|
||||
public BuildResults BuildResults { get; private set; } |
||||
|
||||
public void Build(IProject project) |
||||
{ |
||||
var build = new BuildProject(project); |
||||
build.BuildComplete += BuildComplete; |
||||
buildCompleteEvent.Reset(); |
||||
WorkbenchSingleton.SafeThreadAsyncCall(() => build.Run()); |
||||
if (buildCompleteEvent.WaitOne(DefaultBuildTimeout)) { |
||||
BuildResults = build.LastBuildResults; |
||||
} else { |
||||
BuildResults = GetBuildTimeoutResult(); |
||||
} |
||||
build.BuildComplete -= BuildComplete; |
||||
} |
||||
|
||||
BuildResults GetBuildTimeoutResult() |
||||
{ |
||||
var results = new BuildResults { Result = BuildResultCode.Error }; |
||||
results.Add(new BuildError(String.Empty, "Timed out waiting for build to complete.")); |
||||
return results; |
||||
} |
||||
|
||||
void BuildComplete(object sender, EventArgs e) |
||||
{ |
||||
buildCompleteEvent.Set(); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue