Permalink
Browse files

Create new projects as Any CPU (32-bit) if the .NET 4.5 framework is …

…installed.

Any CPU (32-bit) also works with older target frameworks as those interpret the 32-bit preferred flag as 32-bit required; but we require the new compiler version.
  • Loading branch information...
1 parent 2c4b5da commit ea71582c4f07f0d011c32fa107809a9c3a2ceeee @dgrunwald dgrunwald committed Dec 22, 2012
@@ -17,7 +17,7 @@
</Actions>
<!-- Template Content -->
- <Project language = "C#" defaultPlatform="x86">
+ <Project language = "C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -18,7 +18,7 @@
<Open filename = "MainForm.cs"/>
</Actions>
- <Project language = "C#" defaultPlatform="x86">
+ <Project language = "C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -18,7 +18,7 @@
<Open filename = "NotificationIcon.cs"/>
</Actions>
- <Project language="C#" defaultPlatform="x86">
+ <Project language="C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -19,7 +19,7 @@
</Actions>
<!-- Template Content -->
- <Project language = "C#" defaultPlatform="x86">
+ <Project language = "C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
@@ -16,7 +16,7 @@
<Open filename = "Window1.xaml"/>
</Actions>
- <Project language = "C#" defaultPlatform="x86">
+ <Project language = "C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -16,7 +16,7 @@
<Open filename = "Page1.xaml"/>
</Actions>
- <Project language = "C#" defaultPlatform="x86">
+ <Project language = "C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -20,7 +20,7 @@
<!-- Template Content -->
- <Project language = "VBNet" defaultPlatform="x86">
+ <Project language = "VBNet">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -19,7 +19,7 @@
</Actions>
<!-- Template Content -->
- <Project language="VBNet" defaultPlatform="x86">
+ <Project language="VBNet">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
@@ -18,7 +18,7 @@
<Open filename = "NotificationIcon.vb"/>
</Actions>
- <Project language="VBNet" defaultPlatform="x86">
+ <Project language="VBNet">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -18,7 +18,7 @@
<Open filename = "${ProjectName}.vb"/>
</Actions>
- <Project language="VBNet" defaultPlatform="x86">
+ <Project language="VBNet">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
@@ -16,7 +16,7 @@
<Open filename = "MainWindow.xaml"/>
</Actions>
- <Project language = "VBNet" defaultPlatform="x86">
+ <Project language = "VBNet">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -16,7 +16,7 @@
<Open filename = "Page1.xaml"/>
</Actions>
- <Project language = "VBNet" defaultPlatform="x86">
+ <Project language = "VBNet">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -28,7 +28,6 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
- <ApplicationIcon>..\..\StartUp\Project\Resources\SharpDevelop.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>Full</DebugType>
@@ -61,9 +61,8 @@ public void Initialize (ProjectOptionPanel projectOptions)
supports32BitPreferred = false;
if (DotnetDetection.IsDotnet45Installed()) {
supports32BitPreferred = projectOptions.Project.MinimumSolutionVersion >= Solution.SolutionVersionVS2010;
- var compilableProject = projectOptions.Project as CompilableProject;
- if (compilableProject != null && compilableProject.OutputType == OutputType.Library)
- supports32BitPreferred = false;
+ // Show 32 vs. 64 options even for library projects;
+ // it's relevant for web applications.
}
if (supports32BitPreferred) {
this.TargetCPU.Add(new KeyItemPair("AnyCPU32", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any32}")));
@@ -113,6 +113,13 @@ public override void ProjectCreationComplete()
}
if (fx != null)
UpdateAppConfig(fx);
+ if (Project.OutputType != OutputType.Library) {
+ if (DotnetDetection.IsDotnet45Installed()) {
+ Project.SetProperty(null, Project.ActivePlatform, "Prefer32Bit", "True", PropertyStorageLocations.PlatformSpecific, true);
+ } else {
+ Project.SetProperty(null, Project.ActivePlatform, "TargetPlatform", "x86", PropertyStorageLocations.PlatformSpecific, true);
+ }
+ }
base.ProjectCreationComplete();
}

0 comments on commit ea71582

Please sign in to comment.