从 Visual Studio 配置创建 CSC 调用
我觉得这个问题可能已经得到解答,但我很难找到它。也许将其归因于错误的搜索词。
我已经在 Visual Studio 2005 Professional 中工作了大约一个月,到目前为止,我一直在使用内置编译机制和大多数默认设置(我以任何实际频率更改的唯一内容是构建小路)。然而,我想转向使用更自动化的构建技术。为此,我想切换到使用 csc
调用,而不是按 Ctrl-Shift-B
或 F5
,这样我就可以包括构建脚本和其他工具(如 NAnt)中的行。
我的问题是,Visual Studio 或任何第三方工具是否提供了一种以编程方式将 VS 中的编译设置转换为其等效的 csc
的方法?例如,如果我有一个名为 SampleProject 的项目,其 Output type:
字段设置为 Windows Application,则它看起来会类似于:
csc /output:winexe /target:SampleProject.exe *.cs
我知道手动解决此问题通常并不困难,但如果有一种方法可以自动将它们组合在一起,这样就好多了。
I feel like this is a question that's likely to have been answered already, but I'm having trouble finding it. Chalk it up to bad search terms, perhaps.
I've been working in Visual Studio 2005 Professional for about a month now, and thus far I've been using the built-in compile mechanism with mostly-default settings (the only thing I've changed with any real frequency is the build path). I'd like, however, to move to using more automated build techniques. To that end, I'd like to switch to using csc
calls instead of hitting Ctrl-Shift-B
or F5
, so that I can include the lines in build scripts and other tools (like NAnt).
My question is, does Visual Studio or any third party tool provide a way to programmatically convert the compile setting ins VS to its csc
equivalent? For example, if I have a project called SampleProject with the Output type:
field set to Windows Application, it would look something like:
csc /output:winexe /target:SampleProject.exe *.cs
I know it's usually not terribly difficult to work this out by hand, but if there's a way to automatically pull it together, it's that much better.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于 VS2010,但类似的操作也适用于其他版本:
工具 >选项>项目与解决方案>生成并运行
将“MSBuild 项目生成输出详细程度”更改为“正常”(或更高)
生成,然后打开“输出”窗口(ctrl+w, o)。
将“显示输出自”下拉列表更改为“构建”
您应该会看到指示性的
csc
行。请注意,这不是真正执行的内容;这是一个快乐的谎言。 IIRC 它实际上直接执行,并且在某些极端情况下,它输出的内容与您需要的内容不太相同。Based on VS2010, but similar should work for other versions:
Tools > Options > Projects and Solutions > Build and Run
Change the "MSBuild project build output verbosity" to "Normal" (or higher)
Build, and bring up the Output window (ctrl+w, o).
Change the "Show output from" drop-down to "Build"
You should see an indicative
csc
line. Note this is not truly what it executed; it is a happy lie. IIRC it actually executes directly, and there are some corner-cases where what it outputs there is not quite the same as what you would need.