Skip to content

Commit

Permalink
Expose MsBuild Configuration and Platform setting
Browse files Browse the repository at this point in the history
This allows choosing other (than default) MsBuild configuration, e.g.
MsBuild:Configuration=Release MsBuild:Platform=x64, especially usable
for projects that are not using default (AnyCPU) platforms.

This relates to OmniSharp#202.
  • Loading branch information
AdamVarian committed May 15, 2017
1 parent 2c96996 commit afa2d8e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/OmniSharp.MSBuild/Options/MSBuildOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ public class MSBuildOptions
{
public string ToolsVersion { get; set; }
public string VisualStudioVersion { get; set; }
public string Configuration { get; set; }
public string Platform { get; set; }
public bool EnablePackageAutoRestore { get; set; }

public string MSBuildExtensionsPath { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ private static class PropertyNames
public const string AssemblyName = nameof(AssemblyName);
public const string AssemblyOriginatorKeyFile = nameof(AssemblyOriginatorKeyFile);
public const string BuildProjectReferences = nameof(BuildProjectReferences);
public const string Configuration = nameof(Configuration);
public const string DefineConstants = nameof(DefineConstants);
public const string DesignTimeBuild = nameof(DesignTimeBuild);
public const string DocumentationFile = nameof(DocumentationFile);
Expand All @@ -17,6 +18,7 @@ private static class PropertyNames
public const string MSBuildSDKsPath = nameof(MSBuildSDKsPath);
public const string NoWarn = nameof(NoWarn);
public const string OutputPath = nameof(OutputPath);
public const string Platform = nameof(Platform);
public const string ProjectAssetsFile = nameof(ProjectAssetsFile);
public const string ProjectGuid = nameof(ProjectGuid);
public const string ProjectName = nameof(ProjectName);
Expand Down
12 changes: 12 additions & 0 deletions src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ private static Dictionary<string, string> GetGlobalProperties(MSBuildOptions opt
userOptionValue: options.VisualStudioVersion,
environmentValue: null);

globalProperties.AddPropertyIfNeeded(
logger,
PropertyNames.Configuration,
userOptionValue: options.Configuration,
environmentValue: null);

globalProperties.AddPropertyIfNeeded(
logger,
PropertyNames.Platform,
userOptionValue: options.Platform,
environmentValue: null);

if (PlatformHelper.IsMono)
{
var monoXBuildFrameworksDirPath = PlatformHelper.MonoXBuildFrameworksDirPath;
Expand Down

0 comments on commit afa2d8e

Please sign in to comment.