饭饭TXT > 学习管理 > 《Visual Studio 2010 高级编程(英文出书版)》作者:Nick Randolph/等【完结】 > [Visual.Studio.2010.高级编程].Professional.Visual.Studio.2010.txt

第 17 页

作者:Nick Randolph/等 当前章节:15374 字 更新时间:2026-6-18 14:51

listener application that runs in your system tray and serves these requests. You ’ ll also note that

the address in the browser ’ s address bar points to a local web server on your machine. The online

and offl ine help modes look and behave very similarly to one another, but this chapter specifi cally

focuses on the offl ine help.

This search tool is really mostly for use in the same situations as you might use

the Quick Find tool, but it searches only the current fi le and doesn ’ t have the

additional options that Quick Find does. It does keep the Quick Find dialog

from getting in the way if you don ’ t require these advanced search features.

However, you are better off using the Quick Find dialog if you want to fi nd a

result, make a change, then fi nd the next result, as when fi nding the next result

you would have to start typing the incremental search text all over again.

You may fi nd that you receive a Service Unavailable message when using the help

system. The likely cause of this error is that the help listener is no longer running

in your system tray. Simply open the help system from within Visual Studio and

the help listener will be automatically started again.

accessing Help . 83

84 .

chaPter 5 Find And replAce And help

The help system in Visual Studio is contextual. This means that if the cursor is currently positioned

on or inside a class definition in a project and you press F1, the help window will open immediately

with a mini-tutorial about what the class statement is and how to use it, as shown in Figure 5-14.

fiGure 5-14

This is incredibly useful because more often than not if you

simply press F1, the help system will navigate directly to the help

topic that deals with the problem you’re currently researching.

However, in some situations you will want to go directly to the

table of contents within the help system. Visual Studio 2010

enables you to do this through the Visual Studio Documentation

menu item in its main Help menu (see Figure 5-15).

In addition to the several help links you also have shortcuts to

MSDN forums and for reporting a bug.

navigating and searching the help system

Navigating through the help system should be very familiar, as it is essentially the same as

navigating the Web. On the left-hand side of the browser window you will find links to pages in the

same part of the help system as the page being currently viewed, and you will also find links that

might be related to the current page.

In the top left of the browser window, you will find a search text box. Enter your search query here

(in much the same way you would in a search engine like Google or Bing). This search is a full text

fiGure 5-15

accessing Help .

85

search of the pages in the help system, and your query does not necessarily need to appear in the title

of the pages. This will take you to the results, which are again provided in a manner similar to the

results from a search engine. A one-line extract from the page of each result is displayed to help you

determine if it is the article you are after, and you can click through to view the corresponding page.

configuring the help system

When you first start using the help system, it’s

a good idea to configure it to your needs. To

do so, select the Help . Manage Help Settings

menu. This opens the Help Library Manager

dialog, as shown in Figure 5-16.

The first option, Choose online or local help,

opens another screen in the dialog that enables

you to select whether you will be using the

online or offline help. If you select the online

option, pressing F1 or opening the help from

the Help menu will automatically navigate

to the appropriate page in the documentation

on MSDN online (for the current context in

Visual Studio). Selecting the offline option

will navigate to the appropriate page in the documentation installed locally (assuming that the

documentation has actually been installed on your machine).

The advantage of the online help over the offline help is that it will always be up to date and won’t

consume space on your hard drive (assuming you don’t install the help content). The disadvantage

is that you must always have an active Internet connection, and at times (depending on your

bandwidth) it may be slower than the offline version to access. Essentially it is a trade-off, and you

must choose the most appropriate option for your work environment.

The Check for updates online option will check if there are any updates to each of the product

documentation sets that are currently installed. A screen will show the documentation sets that

are installed and do a check for updates for each. When the checks are complete, it will show an

estimated download size at the bottom of the dialog. Be aware that these documentation sets can

be rather large, and only continue with the update if you have the bandwidth to download files of

that size.

The Find content online option enables you to download and add additional product documentation

sets to your offline library. The dialog will obtain a list of the available documentation sets and their

size from the Internet. You can then click the Add hyperlink button next to each documentation set

that your want to download. Again, be aware that these files can be rather large.

The Find content on disk option enables you to install documentation sets from local media, such as

a CD/DVD, SD card, or hard drive. You will need to navigate to a manifest file (which has a .msha

extension) that accompanies the documentation, and the Help Library Manager will take it from

there and handle the installation of the related documentation.

fiGure 5-16

86 .

chaPter 5 Find And replAce And help

The final option is Remove content, which enables you to remove product documentation sets from

your local disk and free some disk space. The screen will show the documentation sets that are

currently installed, and you can uninstall a documentation set by pressing the Remove hyperlink

button next to its name.

suMMary

As you’ve seen in this chapter, Visual Studio 2010 comes with a number of search-and-replace tools,

each best suited to a particular type of search task to enable you to navigate and modify your code

quickly and easily.

The new help system is a powerful interface to the documentation that comes with Visual Studio

2010. The ability to switch easily between online and local documentation ensures that you can

balance the speed of offline searches with the relevance of information found on the Web. And the

abstract paragraphs that are shown in all search results, regardless of their locations, help reduce

the number of times you might click a false positive.

PART II

Getting started

. chaPter 6: Solutions, Projects, and Items

. chaPter 7: IntelliSense and Bookmarks

. chaPter 8: Code Snippets and Refactoring

. chaPter 9: Server Explorer

. chaPter 10: Modeling with the Class Designer

6 6

solutions, Projects, and items

what’s in this chaPter?

.

Creating and configuring solutions and projects

.

Controlling how an application is compiled, debugged, and

deployed

.

Configuring the many project-related properties

.

Including resources and settings with an application

.

Enforcing good coding practices with the Code Analysis Tools

.

Modifying the configuration, packaging, and deployment options for

web applications

Other than the simplest applications, such as Hello World, most applications require more

than one source file. This raises a number of issues, such as how the files will be named, where

they will be located, and whether they can be reused. Within Visual Studio 2010, the concept

of a solution, containing a series of projects, made up of a series of items, is used to enable

developers to track, manage, and work with their source files. The IDE has a number of built-

in features that aim to simplify this process, while still allowing developers to get the most out

of their applications. This chapter examines the structure of solutions and projects, looking at

available project types and how they can be configured.

solution structure

Whenever you’re working within Visual Studio, you will have a solution open. When you’re

editing an ad hoc file, this will be a temporary solution that you can elect to discard when

you have completed your work. However, the solution enables you to manage the files that

you’re currently working with, so in most cases saving the solution means that you can return

90 . chaPter 6 SoluTionS, projecTS, And iTemS

to what you were doing at a later date without having to locate and reopen the fi les on which you

were working.

Solutions should be thought of as a container of related projects. The projects

within a solution do not need to be of the same language or project type. For

example, a single solution could contain an ASP.NET web application written

in Visual Basic, an F# library, and a C# WPF application. The solution allows

you to open all these projects together in the IDE and manage the build and

deployment confi guration for them as a whole.

The most common way to structure applications written within

Visual Studio is to have a single solution containing a number of

projects. Each project can then be made up of a series of both code

fi les and folders. The main window in which you work with solutions

and projects is the Solution Explorer, shown in Figure 6 - 1.

Within a project, folders are used to organize the source code and

have no application meaning associated with them (with the exception

of web applications, which can have specially named folders that have

specifi c meaning in this context). Some developers use folder names

that correspond to the namespace to which the classes belong. For

example, if class Person is found within a folder called DataClasses in

a project called FirstProject, the fully qualifi ed name of the class could

be FirstProject.DataClasses.Person .

Solution folders are a useful way to organize the projects in a large solution. Solution folders are

visible only in the Solution Explorer — a physical folder is not created on the fi lesystem. Actions

such as Build or Unload can be performed easily on all projects in a solution folder. Solution

folders can also be collapsed or hidden so that you can work more easily in the Solution Explorer.

Projects that are hidden are still built when you build the solution. Because solution folders do not

map to a physical folder, they can be added, renamed, or deleted at any time without causing invalid

fi le references or source control issues.

Miscellaneous Files is a special solution folder that can be used to keep track of

other fi les that have been opened in Visual Studio but are not part of any projects

in the solution. The Miscellaneous Files solution folder is not visible by default.

You can fi nd the settings to enable it under Tools . Options . Environment .

Documents.

There is a common misconception that projects necessarily correspond to .NET assemblies.

Although this is generally true, it is possible for multiple projects to represent a single .NET

assembly. However, this case is not supported by Visual Studio 2010, so this book assumes that a

project will correspond to an assembly.

fiGure 6-1

solution file format .

91

In Visual Studio 2010, although the format for the solution file has not changed, you cannot open

a solution file that was created with Visual Studio 2010 with Visual Studio 2008. However, project

files can be opened with both Visual Studio 2008 and Visual Studio 2010.

In addition to tracking which files are contained within an application, solution and project files

can record other information, such as how a particular file should be compiled, project settings,

resources, and much more. Visual Studio 2010 includes non-modal dialog for editing project

properties, whereas solution properties still open in a separate window. As you might expect, the

project properties are those properties pertaining only to the project in question, such as assembly

information and references, whereas solution properties determine the overall build configurations

for the application.

solution file forMat

Visual Studio 2010 actually creates two files for a solution, with extensions .suo and .sln (solution

file). The first of these is a rather uninteresting binary file, and hence difficult to edit. It contains

user-specific information — for example, which files were open when the solution was last closed

and the location of breakpoints. This file is marked as hidden, so it won’t appear in the solution

folder using Windows Explorer unless you have enabled the option to show hidden files.

Occasionally the .suo file becomes corrupted and causes unexpected behavior

when building and editing applications. If Visual Studio becomes unstable for a

particular solution, you should exit and delete the .suo file. It will be re-created

by Visual Studio the next time the solution is opened.

The .sln solution file contains information about the solution, such as the list of projects, build

configurations, and other settings that are not project-specific. Unlike many files used by Visual

Studio 2010, the solution file is not an XML document. Instead it stores information in blocks, as

shown in the following example solution file:

Microsoft Visual Studio Solution File, Format Version 11.00

# Visual Studio 10

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "FirstProject",

"FirstProject\FirstProject.vbproj", "{D4FAF2DD-A26C-444A-9FEE-2788B5F5FDD2}"

EndProject

Global

GlobalSection(SolutionConfigurationPlatforms) = preSolution

Debug|Any CPU = Debug|Any CPU

EndGlobalSection

GlobalSection(ProjectConfigurationPlatforms) = postSolution

{D4FAF2DD-A26C-444A-9FEE-2788B5F5FDD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

{D4FAF2DD-A26C-444A-9FEE-2788B5F5FDD2}.Debug|Any CPU.Build.0 = Debug|Any CPU

目录
设置
设置
阅读主题
字体风格
雅黑 宋体 楷书 卡通
字体大小
适中 偏大 超大
保存设置
恢复默认
手机
手机阅读
扫码获取链接,使用浏览器打开
书架同步,随时随地,手机阅读
首 页 < 上一章 章节列表 下一章 > 尾 页