如何集成到后台/智能编译 [英] How to integrate into background/intellisense compile

查看:100
本文介绍了如何集成到后台/智能编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Visual Studio可扩展性的新手,一直在寻找一种方法来实现自己想要的功能,但似乎找不到.我只是在寻找有关应了解的界面/服务/主题的一些指导,以了解如何做自己想要的事情.

这是我想要做的.我想生成代码作为背景/智能构建的一部分.例如,我有一个项目A和一个项目B.项目B引用了项目A,并为我的扩展程序包含一个特殊的安装文件,其中包含有关如何生成代码的配置.该代码不仅从安装文件中的内容生成,而且从项目A程序集生成.这就是为什么自定义工具无法实现我想要的功能的原因.我希望程序员能够更改项目A中的代码,转到项目B中的代码,并根据基于对该项目A所做的更改生成的代码获得智能感知. Studio的背景/智能构建,因此当他们更改项目A中的代码时,扩展可以根据项目B的代码自动生成新代码.当然,它可能还需要在构建上运行,以确保在构建时使用它生成的最新数据.我不确定如何也可以进入构建,但似乎会更简单.

有人能指出我正确的方向吗?还是有这样的例子吗?

谢谢,
Jeff

解决方案

我需要了解Visual Studio的背景/智能构建 这样当他们在项目A中更改代码时,扩展名可以 自动根据项目B的代码生成新代码.
这是不可能的,因为智能感知是由您所使用语言的语言服务实现的.语言服务公开的任何机制都可以让我们扩展或挂钩它.

当然,它可能还需要在构建上运行以确保 是的,它更容易使用,请访问以编程方式添加自定义生成事件相关.

谢谢.


I am new to visual studio extensibility and have been looking for a way to do what I want, but can't seem to find it.  I am just looking for some direction as to what interface/service/topic I should look at to learn how to do what I want.

    Here is what I want to do.  I want to generate code as part of the background/intellisense build.  For example, I have project A and project B.  Project B references project A and contains a special setup file for my extension with configuration about how to generate code.  The code is generated not just from what is in the setup file but also from the project A assembly.  That is why a custom tool doesn't do what I want.  I want the programmer to be able to change code in project A, go to code in project B and get intellisense based on code generated based on that change to project A.  I am thinking that to make this work I will need to hook into Visual Studio's background/intellisense build so that when they change code in project A the extension can automatically generate new code based on that for project B.  Of course, it would probably need to run on builds as well to make sure when it builds it uses the most up to date data fro generation.  I am unsure how to hook into the build as well, but it seems like it would be more straightforward.

     Can someone point me in the right direction or is there an example of doing something like this?

Thanks,
Jeff

解决方案

I will need to hook into Visual Studio's background/intellisense build so that when they change code in project A the extension can automatically generate new code based on that for project B. 
This is not possible since the intellisense is implemented by the language service of the language you're using. And a language service exposed any mechanism can let's extend or hook it.

Of course, it would probably need to run on builds as well to make sure when it builds it uses the most up to date data fro generation.
Yes, this is easier, please visit adding custom build events programmatically related.

Thanks.


这篇关于如何集成到后台/智能编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆