VSX:自定义包的项目类型以模仿“调试>>”开始行动>>启动外部程序”
我有一个基于 VSX 包 (2008+) 中的 C# 类库项目类型的自定义项目类型。对于此项目类型,即使输出是类库,我也希望能够通过按 F5(等)来调试此应用程序。我有一个预构建的可执行文件,它将程序集路径作为命令行参数并加载它以进行工作台测试。
我可以通过在属性页中使用项目的“调试>>启动操作>>启动外部程序”来手动模拟此行为,方法是提供可执行文件的路径并提供输出 dll 的相对路径作为命令行争论。但这设置太多了。我希望项目类型的包代码能够自动获取活动配置的程序集和工作台可执行文件的安装位置。
最坏的情况是,每次成功构建后,该项目的属性页都会以编程方式更新为正确的值。我不太喜欢这个解决方案,因为它看起来很混乱,似乎很容易失去同步并向用户暴露这些潜在的错误。
我能想象到的最好的解决方案是在启动调试器事件(仅适用于该项目类型)出现“无法直接启动具有类库输出类型的项目”并执行工作台(附加的调试器)之前拦截该事件。课程)。我不知道VSX是否暴露了必要的部分。
我愿意付费让有经验的人编写这个简单的(?)包(以及一些其他要求,主要是项目级菜单项,已经部分实现),但我还没有找到任何专门研究 VSX 包的顾问。欢迎提出建议。
我采取了错误的方法吗?我假设我需要一个包而不是一个加载项。
I have a custom project type based on the C# Class Library project type in a VSX Package (2008+). For this project type, even though the output is a class library, I want to be able to debug this app just by pressing F5 (etc). I have a prebuilt executable that takes an assembly path as a command-line argument and loads it for workbench testing.
I can simulate this behavior manually by using the Project's "Debug >> Start Action >> Start External Program" in the property pages by providing the path to the executable and providing the relative path to the output dll as a command line argument. But this is too much setup. I would want the project type's package code to be able to grab the assembly of the active configuration and the installed location of the workbench executable automatically.
The worst case scenario would be that after every successful build, the property pages for that project are updated programmatically with the correct values. I don't particularly like this solution because it seems messy, seems like it would be easy to get out of sync and expose those potential errors to the user.
The best solution that I can imagine involved intercepting the Start Debugger event (only for this project type) before it craps out with "A project with an Output Type of Class Library cannot be started directly" and executes the workbench instead (debugger attached, of course). I don't know if VSX exposes the necessary parts.
I would pay to have this simple (?) package (along with a few other requirements, mainly a project-level menu item, already partially implemented) written by someone with experience, but I haven't found any consultants that specialize in VSX packages. Recommendations are welcome.
Am I taking the wrong approach? I'm assuming I need a package rather than an add-in.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的描述,听起来您没有自定义项目类型,而是自定义 项目模板。 (如果您有自己的自定义编程语言,则通常只有您自己的项目类型)。
假设是这种情况,我认为您应该能够 创建您自己的 IWizard 实现 这将设置项目以在项目创建时(即用户完成“新建项目”对话框后)启动主机可执行文件等。
例如,您可以在 IWizard 的 ProjectFinishedGenerating 实施:
Based on your description, it sounds like you don't have a custom project type, but rather a custom project template. (You would typically only have your own project type if you had your own custom programming language).
Assuming this is the case, I think you should be able to create your own IWizard implementation which would set the project up for launching your host executable, etc... at project creation time (i.e. after the user goes through the New Project dialog).
For example, you could do something like the following in the IWizard's ProjectFinishedGenerating implementation: