Browse Source

Fix #244: /platform:anycpu32bitpreferred set for library projects.

pull/343/merge
Andreas Weizel 12 years ago
parent
commit
0a7a97df38
  1. 38
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildAdvanced.xaml.cs

38
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildAdvanced.xaml.cs

@ -68,12 +68,30 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -68,12 +68,30 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
this.SerializationInfo.Add(new KeyItemPair("On", StringParser.Parse("${res:Dialog.ProjectOptions.Build.On}")));
this.SerializationInfo.Add(new KeyItemPair("Auto", StringParser.Parse("${res:Dialog.ProjectOptions.Build.Auto}")));
this.FileAlign = new List<KeyItemPair>();
this.FileAlign.Add(new KeyItemPair("512", "512"));
this.FileAlign.Add(new KeyItemPair("1024", "1024"));
this.FileAlign.Add(new KeyItemPair("2048", "2048"));
this.FileAlign.Add(new KeyItemPair("4096", "4096"));
this.FileAlign.Add(new KeyItemPair("8192", "8192"));
}
public void Load(MSBuildBasedProject project, string configuration, string platform)
{
int val;
if (!int.TryParse(BaseAddress.Value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out val)) {
val = 0x400000;
}
DllBaseAddress = "0x" + val.ToString("x", NumberFormatInfo.InvariantInfo);
this.TargetCPU = new List<KeyItemPair>();
supports32BitPreferred = false;
if (DotnetDetection.IsDotnet45Installed()) {
var outputType = projectOptions.GetProperty("OutputType", OutputType.Exe);
if (DotnetDetection.IsDotnet45Installed() &&
((outputType.Value == OutputType.Exe) || (outputType.Value == OutputType.WinExe))) {
var upgradableProject = projectOptions.Project as IUpgradableProject;
if (upgradableProject != null && upgradableProject.CurrentTargetFramework.Supports32BitPreferredOption)
supports32BitPreferred = projectOptions.Project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010;
supports32BitPreferred = (projectOptions.Project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010);
// Show 32 vs. 64 options even for library projects;
// it's relevant for web applications.
}
@ -87,22 +105,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -87,22 +105,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
this.TargetCPU.Add(new KeyItemPair("x64", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x64}")));
this.TargetCPU.Add(new KeyItemPair("Itanium", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Itanium}")));
this.FileAlign = new List<KeyItemPair>();
this.FileAlign.Add(new KeyItemPair("512", "512"));
this.FileAlign.Add(new KeyItemPair("1024", "1024"));
this.FileAlign.Add(new KeyItemPair("2048", "2048"));
this.FileAlign.Add(new KeyItemPair("4096", "4096"));
this.FileAlign.Add(new KeyItemPair("8192", "8192"));
}
public void Load(MSBuildBasedProject project, string configuration, string platform)
{
int val;
if (!int.TryParse(BaseAddress.Value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out val)) {
val = 0x400000;
}
DllBaseAddress = "0x" + val.ToString("x", NumberFormatInfo.InvariantInfo);
if (supports32BitPreferred && string.Equals(this.PlatformTarget.Value, "AnyCPU", StringComparison.OrdinalIgnoreCase)) {
bool default32BitPreferred = false;
var upgradableProject = projectOptions.Project as IUpgradableProject;

Loading…
Cancel
Save