/// <summary>
/// Initializes the in memory project. Sets BuildEnabled on the project to true.
/// </summary>
/// <param name="engine">The build engine to use to create a build project.</param>
/// <param name="fullProjectPath">The full path of the project.</param>
/// <returns>A loaded msbuild project.</returns>
internal static MSBuild.Project InitializeMsBuildProject(MSBuild.Engine buildEngine, string fullProjectPath)
{
if (buildEngine == null)
{
throw new ArgumentNullException("engine");
}
if (String.IsNullOrEmpty(fullProjectPath))
{
throw new ArgumentException(SR.GetString(SR.InvalidParameter), "fullProjectPath");
}
// Check if the project already has been loaded with the fullProjectPath. If yes return the build project associated to it.
MSBuild.Project buildProject = buildEngine.GetLoadedProject(fullProjectPath);
if (buildProject == null)
{
buildProject = buildEngine.CreateNewProject();
buildProject.BuildEnabled = true;
buildProject.Load(fullProjectPath);
}
return(buildProject);
}