有什么方法可以替代 Visual Studio 对 msbuild 的使用,并且仍然在 IDE 中收到错误报告吗?
有什么方法可以替代 Visual Studio 对 msbuild 的使用,并且仍然在 IDE 中获得错误报告?我想我可能想在 VS 中使用 NAnt、Rake 或 PowerShell 进行编译,或者使用同样智能但使用脚本语言而不是 XML 的东西。我的构建相当简单——找到所有 .cs 并编译它们,然后将 dll 放入调试/或发布/等中。
我想添加许多其他步骤,这些步骤从命令行看起来更容易
- :点击服务器来填充某些缓存。
- 使用 Closure
- Minify CSS
- 进行编译构建后生成一些指标(在特定配置中)
- 运行 NUnit(或自定义)测试框架并发送电子邮件
- 等...
但是,我仍然希望获得“在线错误”反馈IDE 内部。这有可能吗?
Any way to replace visual studio's usage of msbuild and still get error reporting in the IDE? I think I might want to compile in VS with NAnt or Rake or PowerShell, or something that is just as smart but uses a scripting language instead of XML. My build is fairly straight forward -- find all the .cs and compile them and put the dll in a Debug/ or Release/ etc.
I'd like to add a number of other steps that just seem easier from the command line:
- Like hit the server to prime certain caches.
- Compile with Closure
- Minify CSS
- Generate some metrics after build (in a certain config)
- Run NUnit (or custom) testing framework and send an email
- etc....
However, I'd still like to get the "error on line" feed back inside of the IDE. Is this a possibility?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以为 Visual Studio 编写一些扩展(宏、插件、包等),这些扩展可以增强 Visual Studio 以允许其他构建工具运行。最简单的形式可能只是使用“Tools\External Tools..”并在那里添加您的构建工具。只要您按照此处所述设置“构建消息”的格式,应该显示输出窗口,就像它们是由 MSBuild 生成的一样。
但是,我认为不可能(也不可取,顺便说一句)完全取代 Visual Studio 中的 MSBuild。
Visual Studio 不仅执行 MSBuild.exe 并解析其输出。集成非常紧密,并且许多 GUI 方面直接依赖于MSBuild 文件的内容。
例如,当您在 Visual Studio UI 中更改某些项目属性时,更改(最终)将写入项目的 MSBuild 文件。
此外,还有一些性能改进,例如 Visual Studio 使用进程内编译器“替换”了 MSBuild 文件中的 csc.exe(C# 编译器)调用,这可以节省一些编译时间,因为需要启动的外部进程较少(也在 多于提到的文档)
虽然从体系结构的角度来看,所有这些都可能被 Visual Studio 内的某些“接口”包裹和封装,但我还没有找到一种方法让这些“接口”实现其他功能例如,后面使用 NAnt。
无论如何,我认为即使技术上可行,技术上也不可行。
You could write some extension for Visual Studio (Macro, AddIn, Package, etc.) that can augment Visual Studio to let other build tools run. The simplest form is probably just using "Tools\External Tools.." and add your Build Tool there. As long as you format your "build messages" as described here, the should show up the output window as if they were generated by MSBuild.
However, I don't think it is possible (nor desirable, BTW) to completely replace MSBuild in Visual Studio.
Visual Studio not just executes
MSBuild.exe
and parses it's output. The integration is very tight and a lot of GUI aspects rely directly on the content of the MSBuild file.For example, when you change some project properties in the Visual Studio UI, the changes are (eventually) written to the MSBuild file of the project.
Also, there are some performance improvements, for example Visual Studio "replaces", so to say, the call of
csc.exe
(the C# compiler) from an MSBuild file by using an in-process compiler, which safes some compile time, because less external processes need to be launched (also described in the above mentioned document)While all this, from a architectural point of view, is quit likely wrapped and encapsulated by some "interfaces" inside Visual Studio, I haven't yet found a way to have those "interfaces" implement something else that, for example, uses NAnt behind.
Anyway, I think even if technically possible, it would not be technically feasible.
对于 rake,请查看 Rake Runner 扩展。您可以从解决方案资源管理器运行 rake 任务,并在
Output
窗格中检查错误和其他输出。我在开发包方面没有什么经验,所以如果有人想提供帮助,该项目是开源的此处。For rake, check out Rake Runner extension. You can run the rake tasks from the solution explorer and check the errors and other output in the
Output
pane. I have little experience developing vs packages so if anyone want to help, the project is open sourced here.