---
title: "Visual Studio 2008 每日提示(三十二)"
author: "cjc"
date: "2009-03-04T01:15:00Z"
tags: []
slug: "visual-studio-2008"
draft: false
lastmod: "2009-03-04T01:15:00Z"
id: 402645
url: "https://cjc.iteye.com/blog/402645"
---

&lt;script&gt;function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}&lt;/script&gt;

本篇包括tip321-tip330  
[http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-32.html](http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-32.html)

## #321、使用xml可视化工具

原文链接:[You can use the XML Visualizer to view XML](http://blogs.msdn.com/saraford/archive/2008/09/25/did-you-know-you-can-use-the-xml-visualizer-to-view-xml-321.aspx)

**操作步骤：**  
例如，在一段代码段文件里，你有一些有趣的字符串其中包含xml。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanusetheXMLVisualizertovie_12B5B/image_thumb.png)  
你可以选择文本可视化工具，不过看起来不是很舒服  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanusetheXMLVisualizertovie_12B5B/image_thumb_1.png)

如果你选择xml可视化工具，可以看见xml属性高亮显示  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanusetheXMLVisualizertovie_12B5B/image_thumb_2.png)

**评论：在调试状态看有关xml内容选择xml可视化工具最合适了。**

## #322、使用html可视化工具

原文链接:[You can use the HTML Visualizer to view HTML](http://blogs.msdn.com/saraford/archive/2008/09/26/did-you-know-you-can-use-the-html-visualizer-to-view-html-322.aspx)

**操作步骤：**  
对于html可视化工具  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanusetheHTMLVisualizertovi_12D6B/image_thumb.png)  
html会像在浏览器里的显示一样  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanusetheHTMLVisualizertovi_12D6B/image_thumb_2.png)

[http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-32.html](http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-32.html)

**评论：在三个可视化工具里，这个我用的最少。**

## #323、配置在生成前如何保存文件

原文链接: [How to configure how and when the IDE saves your files before building](http://blogs.msdn.com/saraford/archive/2008/09/29/did-you-know-how-to-configure-how-and-when-the-ide-saves-your-files-before-building-323.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+生成并运行**，在“生成前”的下拉选项里有如下选项：

**保存所有更改**：显然，在单击F5生成解决方案或项目的时候，会保存所有未保存的文件。

**仅保存对打开文档的更改**：显然，在生成的时候只保存打开的文档的更改。

**提示保存所有更改**：如果你有未保存的文件，会有个标准的保存对话框。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowHowtoconfigurehowandwhentheIDE_D051/image_thumb.png)

**不保存任何更改**：vs将会基于当前出现在编辑器的代码进行编译生成，而不是针对最后一个保存的文件。

**评论：一般我都会选择“保存所有更改”，让编译的版本和最后保存的版本一致。**

## #324、只有vc支持在IDE里并行生成

原文链接:[Only VC supports parallel building within the IDE](http://blogs.msdn.com/saraford/archive/2008/09/30/did-you-know-only-vc-supports-parallel-building-within-the-ide-324.aspx)

**操作步骤：**

菜单：**工具+选项+项目和解决方案+生成并运行**，有个“最大并行项目生成数”文本框。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowOnlyVCsupportsparallelbuilding_D46D/image_thumb.png)

也许做了尝试，这个功能不能用于非vc的项目。但是，让我奇怪的是没什么标签提示只能用于vc项目。

**评论：真粗心，这个功能我一直没注意过。有关此部分内容请参考链接：[http://msdn.microsoft.com/zh-cn/library/cyhcc7zc.aspx](http://msdn.microsoft.com/zh-cn/library/cyhcc7zc.aspx)**

## #325、运行时仅生成启动项目和依赖

原文链接：[How to build just the startup project and any dependencies](http://blogs.msdn.com/saraford/archive/2008/10/01/did-you-know-how-to-build-just-the-startup-project-and-any-dependencies-325.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+生成并运行**，有个“在运行时仅生成启动项目和依赖”选项  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowHowtobuildjustthestartupprojec_D861/image_thumb.png)

如果你有个非常大的解决方案，如果你想在生成时不生成整个解决方案中全部的项目，就选中这项，可以节约不少时间。

**评论：对于有很多项目的解决方案这个设置确实很节省时间。**

## #326、在vc中档项目过期时会做什么

原文链接：[What to do when projects are out of date is only for VC](http://blogs.msdn.com/saraford/archive/2008/10/02/did-you-know-what-to-do-when-projects-are-out-of-date-is-only-for-vc-326.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+生成并运行**，有个“**运行时，当项目过期时**”的下拉选项，用于生成时你来指定或由vs来确认。

这个选项只针对vc++项目  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Didyouknow_DC55/image_thumb.png)

如果你选择“提示生成”，将会看见如下消息框  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Didyouknow_DC55/image_thumb_1.png)

**评论：注意该选项只适合vc++的项目。**

## #327、生成失败时，指定运行旧版本

原文链接：[You can specify whether to run old version when a build fails](http://blogs.msdn.com/saraford/archive/2008/10/03/did-you-know-you-can-specify-whether-to-run-old-version-when-a-build-fails-327.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+生成并运行**，有个“**运行时，当出现生成或部署错误时**”的下拉选项。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanspecifywhethertorunoldve_E106/image_thumb.png)  
有下列几个选项供选择：

**启动早期版本**：不显示消息框，并且不启动新生成版本的应用程序。在消息框中选择“不再显示此对话框”然后选择“是”，将设置此选项。

**不启动**:不显示消息框，并且不启动应用程序。在消息框中选择“不再显示此对话框”然后选择“否”，将设置此选项。

**提示启动**:每次发生生成错误时都显示消息框。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanspecifywhethertorunoldve_E106/image_thumb_1.png)

**评论：注意该选项只适合vc++。**

## #328、单击生成一个项目作为启动项目

原文链接：[You can single-click to make a project be the startup project](http://blogs.msdn.com/saraford/archive/2008/10/06/did-you-know-you-can-single-click-to-make-a-project-be-the-startup-project-328.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+生成并运行**，有个“对于新解决方案，使用当前选定的项目作为启动项目”。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucansingleclicktomakeaprojec_E61F/image_thumb.png)

如果选中此选项，只对新建的解决方案有效。

**评论：这个选项是为了满足新建解决方案可能没指定启动项目的问题。**

## #329、在输出窗口配置MSBuild的详细信息

原文链接：[You can configure the MSBuild verbosity in the Output window](http://blogs.msdn.com/saraford/archive/2008/10/07/did-you-know-you-can-configure-the-msbuild-verbosity-in-the-output-window-329.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+生成并运行**，有个“ **MSBuild项目生成输出详细信息**”的下拉选项  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanconfiguretheMSBuildverbo_EFB9/image_thumb_8.png)

有五个选项供选择：**安静，最小，正常，诊断，详细**

**安静**：显示生成成功还是失败。如下所示生成成功显示1行内容。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanconfiguretheMSBuildverbo_EFB9/image_thumb_3.png)

**最小**：显示生成的命令行。如果生成成功如下所示会显示2行内容。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanconfiguretheMSBuildverbo_EFB9/image_thumb_9.png)

**正常**：输出MSBuild目标的内容。如果生成成功如下所示显示25行内容。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanconfiguretheMSBuildverbo_EFB9/image_thumb_5.png)

**详细**：显示更多的MSBuild内容。如果生成成功如下所示显示395行内容。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanconfiguretheMSBuildverbo_EFB9/image_thumb_6.png)

**诊断**:显示生成过程的所有详细情况。如果生成成功如下所示显示1097行内容。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanconfiguretheMSBuildverbo_EFB9/image_thumb_7.png)

**评论：默认会选择“最小”，你可以根据自己就的需要来选择。**

## #330、用新建项目对话框在解决方案里添加新项目

原文链接：[You can use the New Project Dialog to add a new project to a solution](http://blogs.msdn.com/saraford/archive/2008/10/08/did-you-know-you-can-use-the-new-project-dialog-to-add-a-new-project-to-a-solution-330.aspx)

**操作步骤：**  
在新建项目对话框里，有个选项“解决方案”的下拉选项，你可以选择“**新建解决方案**”和“**加入解决方案**”  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanusetheNewProjectDialogto_F7B3/image_thumb_2.png)

如果你想在现有的解决方案添加项目就选择“加入解决方案”。

**评论：一般我都是通过解决方案的右键菜单来选择新增项目。**

更多有关Visual Studio 2008 每日提示文章见：[Visual Studio 2008 每日提示系列索引](http://blog.csdn.net/xjbx/archive/2009/01/17/3818780.aspx)

更多文章见：[守望轩](http://www.watch-life.net/)\[[http://www.watch-life.net](http://www.watch-life.net/)/]