Tải bản đầy đủ - 0 (trang)
Chapter 4. Getting Started with Visual Studio

Chapter 4. Getting Started with Visual Studio

Tải bản đầy đủ - 0trang

Introduction

ThischapterintroducesVisualStudio2005tothoseunfamiliar

withthenewversionoftheintegrateddevelopment

environment(IDE).Sincetherearesomanynewfeaturesin

the2005edition,Iexpectthatincludeseveryone.I'llstartby

showingyouhowtosetuptheServerExplorerandToolbarto

makeiteasiertogetstartedwithnewapplications.Thischapter

alsowalksyouthroughthe(veryintuitive)VisualStudio2005

setupprogramand(notsointuitive)customizationroutines.If

you'vealreadyinstalledVisualStudio,youcanjustskimthis

firstsection.However,VisualBasicdevelopersneedtotakea

closelookattheconfigurationsection,asIdiscussre-enabling

anumberoffeaturesyou'llmiss(andIdiscusslaterinthe

book).I'llalsoprovideabrieftouroftheVisualStudioIDEso

thatyou'llknowwherethetoolbox,ServerExplorer,andother

windowsarelocated;howtocustomizetheirappearance;and

howtousethesetoolsasyoudevelop,test,debug,anddeploy

applications.I'llshowyouhowtosetupdatabaseconnections

toyourSQLServerorotherdatasources,includinglocal

instancesofSQLServerExpressedition.Rememberthatthisis

a"data-centric"book,soI'llfocusquiteabitonthe"data"

featuresoftheIDE.IleavemanyoftheotherUI[1]designtools

andelementstootherchapters(andotherbooks).

[1]UI:UserInterface.







HowIGotHere

I'vebeenworkingwithMicrosoft"visual"toolssincethefirst

versionofVisualBasicwasreleasedin1991,over14yearsago.

Sincethen,VisualBasicwasjoinedbyothervisuallanguage

developmenttoolseachwithitsownuniquecharacteristicsand

following.Inouropinion,thefolksatMicrosoftdecideditwas

expensivetokeepdevelopingandmarketinglanguage-specific

IDEsanddecided(somewhatunwisely,IMHO)tocreate"Visual

Studio"toactasabundledlaunchingpadforVisualBasicand

theothervisuallanguages.Atfirst,eachlanguagehaditsown

language-specificdeveloperinterface,butwhenVisualStudio

.NET1.0appearedin2000,theseweremorphedtogether

(moreorless)intoacommonIDE,despitesubstantive

differencesinthedevelopmentparadigms.AsIseeit,

compromisesweremadeateveryturntoimplementthis

approach.Sincethen,VisualStudiohasfurther"evolved"and

genericizedsodeveloperscouldtuneandconfiguretheIDEto

matchtheirspecificneedsand(moreimportantly)thefamiliar

keyboardandwindowlayoutstowhichtheyhadgrown

accustomedovertheyears.TheVisualStudio2005versionis

farmoretolerantofotherconfigurationsitsupportsconfigurable

profilestoalterthekeyboardshortcutsandIDElayouts.While

VisualStudio2005hasmadeanumberofsomewhatrude

assumptionsaboutVisualBasicdevelopers,VisualStudio2005

canbeeasilyreconfiguredassumingyouknowwhattoaskfor.

I'llshowyouhowtoconfigurethesesettingsinthischapter.

Sadly,ifyouchoosethe"VisualBasic"profile,Microsoft

assumesthatyouarea"hobbyist,"soithidesanumberof

importantfeatureslikeyourmommyputtingawaythesharp

scissorsandchainsaw,incaseyoumightbetemptedtosawup

yoursister.I'lltellyouhowtore-enablethesefeaturesinthis

chapterbutpleasedon'tdismemberanyoneinyour(ormy)

family.



Atonepointintime,IthoughtMicrosofthadstartedtoreevaluatethewisdomofthisOSFA[2]approachtotheapplicationdevelopmenttools.Itdoesnottakearocketscientisttorealize

thataWebServiceandanASP.NETapplicationhaveverylittle

incommon.IfyouaddtothatWindowsForms(whattheynow

call"SmartClient")applications,youeasilyseethatacommon

IDEdoesn'treallymakealotofsenseexceptthatit'seasierto

packageandsell.Giventhatnewweb-centrictoolshavebeen

createdtocompetewithVisualStudio,youcanunderstand

Microsoft'smotivationtobreakthestudioapart.Idoubtifthis

willhappenanytimesoonespeciallygiventhefactthatthey

haverecentlycombinedtheASPandWindowsFormsteamsinto

onegroup.The"Orcas"version(duetobereleasednearthe

Vistatimeframe)isprettymuchdesignedandwellalongthe

waytowardalate2006orearly2007launch.Perhapsthe

followingrelease("Hawaii")willincorporatethis"separatebut

equal"approachbutIdoubtit.

[2]OSFA:Onesizefitsall.



Installingthe"Right"VersionofVisualStudio

WhenVisualStudiofirstwenttomarket,itappearedina

dizzyingarrayofversions.Theseinclude"Express","Standard",

"Professional",and"Team"SKUs[3].Iwon'tattempttodescribe

thedifferencesbetweentheseversions,asMicrosofthasdonea

prettygoodjobofdoingso[4].ConsiderthatI'mdevelopingthe

materialsforthebookusingtheTeamEdition(forSoftware

Developers).Thisversionexposesthe(copious)project

managementaswellascodeanalysistoolsusedtobuildand

testthecode.Nope,thiseditionisprobablytooexpensivefor

manydevelopmentshops.Atalmost$3,000,it'sfairlypricy.

WhiletheExpresseditionsarefreelydownloadable,theylack

manyofthefeaturesyou'llneedinordertocreate,test,and

deployseriousapplications.Iexpectyou'llwanttousethe

Standard($200)or(morelikely)theProfessionalEdition

($2,500).Giventheprices,youmightfinditmorecost-effective

tosignupforanMSDNsubscription.ManyofthedevelopersI

meetatconferencesaresubscribersgenerally,theyfindthe

abilitytodownloadwhatevertoolstheyneedondemandisa

substantialbenefitandworththeprice.Ifyou'reastudent,

checkwithyourschoolorinstructororthatguyinthedorm

thatseemstohaveeverything.Mostinstitutionsofferacademic

discountsexceptthosethatadvocateuseofopensource.Just

don'tgetcaughtwithapiratedversion.There'snotellingwhat

itcandotoyoursystem.

[3]SKU:Stock-keepingunits.ThisisthetermusedtorefertoindividualproductslikeVisualStudio2005,

StandardEdition.



[4]http://msdn.microsoft.com/vstudio/products/



EachversionofVisualStudioisdesignedforaspecificversion

ofthe.NETFramework.Thismeansthatyouwon'tbeableto

referenceanyotherversionoftheFramework.Theoriginal

VisualStudio.NET(1.0)supportsdevelopmentagainstthe1.0



versionofthe.NETFramework.VisualStudio.NET2003

supportsthe1.1FrameworkandVisualStudio2005supports

the2.0Framework.No,youwon'tbeabletocreateapplications

targetedtoadown-level(orup-level)versionofthe.NET

Framework.TheOrcasversionpromisestoaddressthis

(somehow),butit'snotatallclearwhatthatmeansinreality.



DealingwithCTPorBetaShards

Sincethisbookwillappearlongafterthebetaandcommunity

techpreview(CTP)releasesofVisualStudio2005,youshould

nothavetoworryaboutinstallingVisualStudioonasystem

thathashadoneofthepre-releaseversionsinstalled.However,

thereareCTPversionsofOrcasbeingdistributedasIwritethis

book.Tobeperfectlyclear,youshouldnevertrytoinstallaprereleasedcopyofanysoftware(Microsoftornot)onasystem

thatyoucan'taffordtoreformatorre-imagewithease.Please

understandthatit'svirtuallyimpossibletouninstallsoftwareas

complexasVisualStudioorSQLServerit'sliketryingtoremove

allofthericefromyoursuitcasesafteryourhoneymoon.I've

hadmixedsuccessusingthe"uninstaller"utilitiesthatMicrosoft

(andothers)provide.Yes,somefolksreportthattheseutilities

workfineand,inonecase,oneoftheseutilitieswasableto

cleanuponeofmysystems(afterseveralhours)topermita

fullinstall.However,myconcernisthatifthey"seem"towork

butdon'tclearouteveryjaggedshardoftheprevious

installationleftbehindaftertheuninstall,yourapplication

developmentexperiencemightbeplaguedwithproblemsthat

arehard(toimpossible)tonaildown.Again,Irecommendthat

yousetupyourVisualStudio2005ona"clean"systemonethat

hasneverhadanybetasoftwareinstalled.



WalkingThroughaTypicalInstallation



TheinstallationdialogsinVisualStudioareeasierthaneverto

run.TheSetupprogram(launchedbyautostartontheDVD)

beginswitha"navigator"dialog,asshowninFigure4.1



Figure4.1.TheinitialsetupdialogforVisual

Studio2005.



I'minstallingtheProfessionalEditioninthiswalkthrough.The

Express,Standard,andTeameditionsusedifferent(albeit

similar)setupprograms.TheExpresssetuphasonlytwo

optionsinstallSQLServerExpressEditionornot.



It'sfromherethatyoucaninstall(stepbystep)VisualStudio

andthedocumentationandcheckforupdates.AsSetup

completeseachphase,itreturnstothisdialog.Clickon"Install

VisualStudio2005"toproceed.

AsSetupcontinues,itcheckstoseeifanyrecognizableshards

ofthebetaorCTPversionsremainonyoursystemno,itdoes

notalwaysfindthemall.Italsocheckstoseeifyou'rerunning

oneoftheacceptableOSandhardwareconfigurations.

Ifyou'rerunningCP/Mandhavefiguredouthowtostartsetup,

you'llfindthatitwon'tgetveryfar.



Ifyoursystempassesmuster,you'llseethefirstdialogthat

asksifyouwanttosendinformationaboutyoursetup

experiencetoMicrosoft(seeFigure4.2).Ifyouchoosethis

option,Microsoftsendsareportbacktothemothershipif

Setupgetsthatfar.Thisdata(supposedly)helpsMicrosoft

refinethesetuproutineseitherthatorithelpsidentifythetypes

ofsystemspeoplearetryingtouseorthebrandofcigarsyou

smoke.



Figure4.2.Doyouwanttosendinformationback

toMicrosoft?



[Viewfullsizeimage]



Thenextdialogyou'll(eventually)see(Figure4.3)reportson

thesetupcomponentsalreadyinstalledonyoursystem.Inthis

case,I'vealreadyinstalledthe"Professional"versionofVisual

Studio2005,soSetupfoundmanyofthefundamental

componentsalreadyinplacelikethe2.0Framework.Enterthe

productkeyasprovidedwithVisualStudio2005andclick

NextafteryouacceptthetermsoftheEndUserLicense

Agreement(EULA).Ofcourse,Irecommendthatyoureadthis

contractcarefullyorgetyourattorneytodoso.Ithasbeen

rumoredthatearlierversionsoftheEULAcontainedreferences

toyourfirst-bornchildandperiodsofunpaidservitude.



Figure4.3.Entertheproductkeyprovidedinyour

VisualStudiopackaging.



[Viewfullsizeimage]



Onceyou'veacceptedtheEULA,you'llbeaskedtochoosewhat

typeofinstallationyouwant(seeFigure4.4).Irecommend

thatyouchoose"Custom".Thisway,youcanenableordisable

specificlanguagesthatyouintendtouse.Thisapproachcan

meanafasterinstallandfewerirrelevantbitsbeingdumpedon

yourharddrive.Thisdialogalsoreportsonavailablediskspace

andtheamountofspaceyourchoice(might)require.You'llget

anotherchancetosetthispathinthenextdialog(ifyouchoose

"Custom").



Figure4.4.Choose"Custom"topermitselection

ofthelanguagesandfeaturestoinstall.



[Viewfullsizeimage]



Onthe"Custom"optionspage,youcandisableinstallationof

anyofthelanguagesorfeaturesthatyoudon'tneed.Inthis

case,Idisabledthe"VisualC++"language.Notethatasyou

unchecklanguagesorfeatures,theamountofdiskspace

requiredfortheinstallationisadjustedaccordingly.Notethat

VisualSourceSafeisnotlistedhereasanoption.You'llhaveto

installthatseparatelyifyourSKUincludesit.Ifyouseeagreen

boxinoneoftheoptioncheckboxes,itmeansthatonlypartof

thatfeatureistobeinstalled.You'llneedtodrillintoeachof

theseitemstoenable/disablespecificcomponents.

SQLServerExpresseditionisoneoftheoptionsyou'llseein

someVisualStudioSKUs.Ifyouchoosetoinstallit,theSetup

programwilltakeallofthedefaultoptionsandinstallanamed

instance(SQLEXPRESS)ofSQLServeronyoursystem.I'll

discusshowtotuneupthatinstancelaterinthischapter.

However,ifyouwanttocustomizetheSQLServerExpress

installation(andmanyofyouwillwantto),unchecktheSQL



ServerExpressoption.OnceVisualStudiohasinstalled,youcan

gobackandruntheSQLServerExpresssetup

independentlyyou'llbeabletocustomizethelocationandother

attributesoftheinstallationatthattime.



Figure4.5.Checkoruncheckthefeaturesand

languagesyouneedordon'tneed.



[Viewfullsizeimage]



Onceyouclick"Install",setupproceedstoinstalltheselected

languagesandfeaturesonyourharddisk.Whenit'sfinished

installing,you'llgetareportonanyissuesthatremain(as

showninFigure4.6).Inthiscase,IchoosetheOffice2003

developmentfeatures,butIdon'thaveOffice2003installedon

themachine.Icanignorethiswarning.



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 4. Getting Started with Visual Studio

Tải bản đầy đủ ngay(0 tr)

×