【问题标题】:How do I use BuildManager on projects using C# 6 [duplicate]如何在使用 C# 6 的项目中使用 BuildManager [重复]
【发布时间】:2016-03-12 21:51:39
【问题描述】:

我有以下代码用于在solutionPath 构建解决方案:

var properties = new Dictionary<string, string>();
properties["Configuration"] = buildType;
properties["Platform"] = "x86";

var request = new BuildRequestData(solutionPath, properties, null, new string[] { "Build" }, null);
var result = BuildManager.DefaultBuildManager.Build(parameters, request);

效果很好,除非我的项目包含 C# 6.0 功能,否则我会出错。例如:

throw new ArgumentException($"Could not find any registered events with the name {name}.");

给我以下内容:

错误意外字符'$'

我是否需要更改 BuildManager 或参数上的某些设置?我正在构建的应用程序以 .NET 4.6 为目标,由 Visual Studio 2015 构建。

【问题讨论】:

    标签: c# msbuild c#-6.0


    【解决方案1】:

    看起来我的项目引用了相关 .dll 的旧版本:

    • Microsoft.Build
    • Microsoft.Build.Engine
    • Microsoft.Build.Framework

    更多信息在这里:

    BuildManager to use another version of MSBuild

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 2019-02-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多