Skip to content
Browse files

[MSBuild] Complete fix for #2226 - Platform value in MSBuild not the …

…same as VS
  • Loading branch information...
1 parent f5945b8 commit 37528ee9061dd6eb6472a6ffd05bb3bf51da72bf @mhutch mhutch committed
View
21 main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
@@ -153,6 +153,16 @@ public override void Dispose ()
Runtime.SystemAssemblyService.DefaultRuntimeChanged -= OnDefaultRuntimeChanged;
}
+ //for some reason, MD internally handles "AnyCPU" as "", but we need to be explicit when
+ //passing it to the build engine
+ static string GetExplicitPlatform (SolutionItemConfiguration configObject)
+ {
+ if (string.IsNullOrEmpty (configObject.Platform)) {
+ return "AnyCPU";
+ }
+ return configObject.Platform;
+ }
+
IEnumerable<string> IAssemblyReferenceHandler.GetAssemblyReferences (ConfigurationSelector configuration)
{
if (useXBuild) {
@@ -160,7 +170,7 @@ IEnumerable<string> IAssemblyReferenceHandler.GetAssemblyReferences (Configurati
SolutionEntityItem item = (SolutionEntityItem) Item;
RemoteProjectBuilder builder = GetProjectBuilder ();
SolutionItemConfiguration configObject = item.GetConfiguration (configuration);
- foreach (string s in builder.GetAssemblyReferences (configObject.Name, configObject.Platform))
+ foreach (string s in builder.GetAssemblyReferences (configObject.Name, GetExplicitPlatform (configObject)))
yield return s;
}
else {
@@ -184,14 +194,7 @@ public override BuildResult RunTarget (IProgressMonitor monitor, string target,
LogWriter logWriter = new LogWriter (monitor.Log);
RemoteProjectBuilder builder = GetProjectBuilder ();
-
- //for some reason, MD internally handles "AnyCPU" as "", but we need to be explicit when
- //passing it to the build engine
- var platform = configObject.Platform;
- if (platform.Length == 0)
- platform = "AnyCPU";
-
- MSBuildResult[] results = builder.RunTarget (target, configObject.Name, configObject.Platform,
+ MSBuildResult[] results = builder.RunTarget (target, configObject.Name, GetExplicitPlatform (configObject),
logWriter, verbosity);
System.Runtime.Remoting.RemotingServices.Disconnect (logWriter);

0 comments on commit 37528ee

Please sign in to comment.
Something went wrong with that request. Please try again.