使用DTE,读取.NET标准项目,配置管理器属性属性值抛出

时间:2019-05-05 00:38:28

标签: c# envdte configurationmanager

我的项目是Visual Studio 2019中的VSIX项目。

我正在使用DTE2读取每个构建配置,然后检查NoWarn属性的值。

对于WPF项目等.NET项目,下面的代码可以完美地工作。

对于.NET Standard项目,尝试读取nownarnProperty.Value时崩溃。

foreach (Configuration configuration in project.ConfigurationManager) {
    Properties configurationProperties = configuration.Properties;
    Property nowarnProperty = configurationProperties.Item("NoWarn");
    var value = nowarnProperty.Value;
}

.NET Standard项目在尝试读取值时抛出:

StackTrace-nowarnProperty.Value'nowarnProperty.Value'引发了类型为'System.Runtime.InteropServices.COMException'对象的异常{System.Runtime.InteropServices.COMException}

问题

  • Microsoft是否有不同的方法来读取之间的值 .NET项目和.NET标准项目?

  • 是否有一个特殊的库可以用来读取上述属性
    值吗?

非常感谢您

卡尔

0 个答案:

没有答案
相关问题