Browse Source

Create new projects as x86 by default - AnyCPU leads to programs running as 64-bit process without ever being tested that way.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4810 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
511a9016f8
  1. 1
      src/Main/Base/Project/Src/Project/CompilableProject.cs
  2. 13
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs
  3. 31
      src/Main/Base/Project/Src/Project/Solution/Solution.cs

1
src/Main/Base/Project/Src/Project/CompilableProject.cs

@ -88,6 +88,7 @@ namespace ICSharpCode.SharpDevelop.Project
PropertyStorageLocations.ConfigurationSpecific, true); PropertyStorageLocations.ConfigurationSpecific, true);
SetProperty("Release", null, "OutputPath", @"bin\Release\", SetProperty("Release", null, "OutputPath", @"bin\Release\",
PropertyStorageLocations.ConfigurationSpecific, true); PropertyStorageLocations.ConfigurationSpecific, true);
InvalidateConfigurationPlatformNames();
SetProperty("Debug", null, "DebugSymbols", "True", SetProperty("Debug", null, "DebugSymbols", "True",
PropertyStorageLocations.ConfigurationSpecific, true); PropertyStorageLocations.ConfigurationSpecific, true);

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

@ -167,10 +167,11 @@ namespace ICSharpCode.SharpDevelop.Project
MSBuild.BuildPropertyGroup group = project.AddNewPropertyGroup(false); MSBuild.BuildPropertyGroup group = project.AddNewPropertyGroup(false);
group.AddNewProperty(ProjectGuidPropertyName, IdGuid, true); group.AddNewProperty(ProjectGuidPropertyName, IdGuid, true);
group.AddNewProperty("Configuration", "Debug", true).Condition = " '$(Configuration)' == '' "; group.AddNewProperty("Configuration", "Debug", true).Condition = " '$(Configuration)' == '' ";
group.AddNewProperty("Platform", "AnyCPU", true).Condition = " '$(Platform)' == '' "; group.AddNewProperty("Platform", "x86", true).Condition = " '$(Platform)' == '' ";
this.ActiveConfiguration = "Debug"; this.ActiveConfiguration = "Debug";
this.ActivePlatform = "AnyCPU"; this.ActivePlatform = "x86";
SetProperty(null, "x86", "PlatformTarget", "x86", PropertyStorageLocations.PlatformSpecific, false);
} }
/// <summary> /// <summary>
@ -1135,6 +1136,14 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} }
protected void InvalidateConfigurationPlatformNames()
{
lock (SyncRoot) {
configurationNames = null;
platformNames = null;
}
}
/// <summary> /// <summary>
/// Load available configurations and platforms from the project file /// Load available configurations and platforms from the project file
/// by looking at which conditions are used. /// by looking at which conditions are used.

31
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -252,8 +252,35 @@ namespace ICSharpCode.SharpDevelop.Project
public override void AddFolder(ISolutionFolder folder) public override void AddFolder(ISolutionFolder folder)
{ {
IProject project = folder as IProject;
if (project != null) {
if (this.GetConfigurationNames().Count == 0) {
foreach (string config in project.ConfigurationNames) {
foreach (string platform in project.PlatformNames)
AddSolutionConfigurationPlatform(config, FixPlatformNameForSolution(platform), null, false, false);
}
}
}
base.AddFolder(folder); base.AddFolder(folder);
guidDictionary[folder.IdGuid] = folder; guidDictionary[folder.IdGuid] = folder;
if (project != null) {
var projectConfigurations = project.ConfigurationNames;
var solutionConfigurations = this.GetConfigurationNames();
var projectPlatforms = project.PlatformNames;
var solutionPlatforms = this.GetPlatformNames();
foreach (string config in solutionConfigurations) {
string projectConfig = config;
if (!projectConfigurations.Contains(projectConfig))
projectConfig = projectConfigurations.FirstOrDefault() ?? "Debug";
foreach (string platform in solutionPlatforms) {
string projectPlatform = FixPlatformNameForProject(platform);
if (!projectPlatforms.Contains(projectPlatform))
projectPlatform = projectPlatforms.FirstOrDefault() ?? "AnyCPU";
CreateMatchingItem(config, platform, project, projectConfig + "|" + FixPlatformNameForSolution(projectPlatform));
}
}
}
} }
#endregion #endregion
@ -577,6 +604,8 @@ namespace ICSharpCode.SharpDevelop.Project
} }
ProjectSection newSec = new ProjectSection("SolutionConfigurationPlatforms", "preSolution"); ProjectSection newSec = new ProjectSection("SolutionConfigurationPlatforms", "preSolution");
this.Sections.Insert(0, newSec); this.Sections.Insert(0, newSec);
// convert VS 2003 solution to VS 2005 (or later)
foreach (ProjectSection sec in this.Sections) { foreach (ProjectSection sec in this.Sections) {
if (sec.Name == "SolutionConfiguration") { if (sec.Name == "SolutionConfiguration") {
this.Sections.Remove(sec); this.Sections.Remove(sec);
@ -584,7 +613,7 @@ namespace ICSharpCode.SharpDevelop.Project
// item.Name = item.Location // item.Name = item.Location
// might be ConfigName.0 = Debug (VS.NET) // might be ConfigName.0 = Debug (VS.NET)
// or Debug = Debug (VS.NET 03) // or Debug = Debug (VS.NET 03)
newSec.Items.Add(new SolutionItem(item.Location + "|Any CPU", item.Location + "|Any CPU")); newSec.Items.Add(new SolutionItem(item.Location + "|x86", item.Location + "|x86"));
} }
break; break;
} }

Loading…
Cancel
Save