Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MsBuild Configuration and Platform setting #858

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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