c# - 从 .NET Core 项目的 VSIX 插件获取 StartArguments
问题描述
编辑- 看起来最初的问题仅适用于 .NET Core 项目。所以问题转移到“从 .NET Core 项目中获取全部项目属性的正确方法是什么?”
我正在编写一个使用一些项目配置设置的 Visual Studio 2019 插件。Project
获取对象(这里是 C#,还有 C++ 和其他)似乎很简单,然后Configuration
为对象挖掘 's Property
。
但似乎访问大多数属性都会抛出System.NotImplementedException
.
主要问题:是否有其他方法可以访问这些设置 - 例如启动参数和其他调试配置?
第二个问题:这东西有什么好的资源吗?在线 MS 文档对我来说有点简洁。
void ProcessCSharpProject(VSProject csProj)
{
foreach (var config in csProj.Project.ConfigurationManager.Cast<Configuration>())
{
Property debugInfoProp = config.Properties.Item("DebugInfo");
var debugInfo = debugInfoProp.Value as String; // works
Property startArgsProp = config.Properties.Item("StartArguments");
var startArgs = startArgsProp.Value as String; // NotImplemented
// Another way to access the same thing:
var configProps = config.Object as CSharpProjectConfigurationProperties6;
var startArgs2 = configProps.StartArguments; // Also NotImplemented
}
}
谢谢!
解决方案
推荐阅读
- c# - 有没有办法将计算字段附加到 Select()?
- c++ - 将 libtomcrypt 和 libtommath 添加到我的 c++ 项目中
- c# - API WebService 没有响应
- genexus - Genexus 15 升级 11 Webnotifications throw java.lang.ClassNotFoundException: com.genexus.internet.websocket.GXWebSocket
- php - 第一个 SQL 数据库不工作
- autoit - AutoIt 等待 Chrome 加载
- angular - 是否可以在特定的 DOM 元素上打开 angular/Material2 Snackbar?
- fortran - Fortran的“include”语句和“#include”指令的区别
- c# - 优化代码
- php - 维护:单例与依赖注入