Browse Source

Initialize $(SharpDevelopBinPath) for project copy done when editing inactive configuration/platform. Fixed forum-13465.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2079 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
2d6c265816
  1. 6
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs
  2. 16
      src/Main/Base/Project/Src/Project/MSBuildInternals.cs
  3. 49
      src/Main/Core/Project/Src/Services/MessageService/MessageService.cs

6
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -112,7 +112,7 @@ namespace ICSharpCode.SharpDevelop.Project
protected virtual void Create(ProjectCreateInformation information) protected virtual void Create(ProjectCreateInformation information)
{ {
InitializeMSBuildProject(); InitializeMSBuildProject(project);
Name = information.ProjectName; Name = information.ProjectName;
FileName = information.OutputProjectFileName; FileName = information.OutputProjectFileName;
@ -788,7 +788,7 @@ namespace ICSharpCode.SharpDevelop.Project
#region Loading #region Loading
protected bool isLoading; protected bool isLoading;
void InitializeMSBuildProject() internal static void InitializeMSBuildProject(MSBuild.Project project)
{ {
project.GlobalProperties.SetProperty("BuildingInsideVisualStudio", "true"); project.GlobalProperties.SetProperty("BuildingInsideVisualStudio", "true");
foreach (KeyValuePair<string, string> pair in MSBuildEngine.MSBuildProperties) { foreach (KeyValuePair<string, string> pair in MSBuildEngine.MSBuildProperties) {
@ -802,7 +802,7 @@ namespace ICSharpCode.SharpDevelop.Project
try { try {
this.FileName = fileName; this.FileName = fileName;
InitializeMSBuildProject(); InitializeMSBuildProject(project);
try { try {
project.Load(fileName); project.Load(fileName);

16
src/Main/Base/Project/Src/Project/MSBuildInternals.cs

@ -119,11 +119,17 @@ namespace ICSharpCode.SharpDevelop.Project
if (tempProject != null && tempProject != baseProject) { if (tempProject != null && tempProject != baseProject) {
tempProject.ParentEngine.UnloadAllProjects(); tempProject.ParentEngine.UnloadAllProjects();
} }
MSBuild.Engine engine = CreateEngine(); try {
tempProject = engine.CreateNewProject(); MSBuild.Engine engine = CreateEngine();
tempProject.LoadXml(baseProject.Xml); tempProject = engine.CreateNewProject();
tempProject.SetProperty("Configuration", configuration); MSBuildBasedProject.InitializeMSBuildProject(tempProject);
tempProject.SetProperty("Platform", platform); tempProject.LoadXml(baseProject.Xml);
tempProject.SetProperty("Configuration", configuration);
tempProject.SetProperty("Platform", platform);
} catch (Exception ex) {
ICSharpCode.Core.MessageService.ShowWarning(ex.ToString());
tempProject = baseProject;
}
} }
internal static PropertyStorageLocations GetLocationFromCondition(string condition) internal static PropertyStorageLocations GetLocationFromCondition(string condition)

49
src/Main/Core/Project/Src/Services/MessageService/MessageService.cs

@ -81,20 +81,17 @@ namespace ICSharpCode.Core
} }
if (MessageService.MainForm == null) { if (MessageService.MainForm == null) {
// let's try this; don't know if it's threadsafe? I expect MessageBox.Show(StringParser.Parse(msg), StringParser.Parse("SharpDevelop: ${res:Global.ErrorText}"), MessageBoxButtons.OK, MessageBoxIcon.Error);
// that MainForm.InvokeRequired can be assumed to be false
// if MainForm doesn't exist yet...
MessageBox.Show(StringParser.Parse(msg), StringParser.Parse("SharpDevelop: ${res:Global.ErrorText}"), MessageBoxButtons.OK, MessageBoxIcon.Error);
} else { } else {
MethodInvoker showError = delegate { MethodInvoker showError = delegate {
MessageBox.Show(MessageService.MainForm, StringParser.Parse(msg), StringParser.Parse("${res:Global.ErrorText}"), MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(MessageService.MainForm, StringParser.Parse(msg), StringParser.Parse("${res:Global.ErrorText}"), MessageBoxButtons.OK, MessageBoxIcon.Error);
}; };
if (MessageService.MainForm.InvokeRequired) { if (MessageService.MainForm.InvokeRequired) {
MessageService.MainForm.BeginInvoke(showError);; MessageService.MainForm.BeginInvoke(showError);
} else { } else {
showError(); showError();
} }
} }
} }
@ -102,13 +99,25 @@ namespace ICSharpCode.Core
{ {
message = StringParser.Parse(message); message = StringParser.Parse(message);
LoggingService.Warn(message); LoggingService.Warn(message);
MessageBox.Show(MessageService.MainForm,
message, string caption = StringParser.Parse("${res:Global.WarningText}");
StringParser.Parse("${res:Global.WarningText}"), if (MessageService.MainForm == null) {
MessageBoxButtons.OK, MessageBox.Show(message, caption,
MessageBoxIcon.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning,
MessageBoxDefaultButton.Button1, MessageBoxDefaultButton.Button1, GetOptions(message, caption));
GetOptions(message, message)); } else {
MethodInvoker showWarning = delegate {
MessageBox.Show(MessageService.MainForm,
message, caption,
MessageBoxButtons.OK, MessageBoxIcon.Warning,
MessageBoxDefaultButton.Button1, GetOptions(message, caption));
};
if (MessageService.MainForm.InvokeRequired) {
MessageService.MainForm.BeginInvoke(showWarning);
} else {
showWarning();
}
}
} }
public static void ShowWarningFormatted(string formatstring, params string[] formatitems) public static void ShowWarningFormatted(string formatstring, params string[] formatitems)

Loading…
Cancel
Save