DEV232 Source Control and Team Development Using Visual Studio.NET and Visual SourceSafe Alfredo...
-
Upload
lydia-fitzgerald -
Category
Documents
-
view
223 -
download
0
Transcript of DEV232 Source Control and Team Development Using Visual Studio.NET and Visual SourceSafe Alfredo...
DEV232Source Control and Team Development Using Visual Studio .NET and Visual SourceSafe
Alfredo Méndez
Program Manager
Microsoft Corporation
OverviewAgenda
Team Development Tips
SourceSafe Best Practices
Changes in Visual Studio .NET 2003
Summary and Discussion
Recommendations
Not one-size-fits all
Only one developer can debug a server host Web application (or Web service) at a time
Takes too long for each developer to compile and build entire team’s codebase
References work on one developer’s machine, but not another
Difficult to match binary assemblies to source code files used to build them
TIP: Use Assembly Versions…and SourceSafe labels
Difficulty Working In TeamsWith Visual Studio .NET and SourceSafe
[assembly: AssemblyVersion("1.0.1001.1")][assembly: AssemblyVersion("1.0.1001.1")]
Unit Unit Test Test
Unit Unit Test Test
Team Development ProcessHigh-level Lifecycle
Business NeedBusiness Needor New Ideaor New Idea
GatherGatherRequirementsRequirements
TestTestSystemSystem
ReleaseReleaseand Deployand Deploy
ImplementImplementand Developand Develop
ImplementImplementand Developand Develop
ImplementImplementand Developand Develop
ImplementImplementand Developand Develop
ImplementImplementand Developand DevelopRepeatable &Repeatable &
ReliableReliable
FastFast
Multiple Check-outs, Multiple Solution Files Multiple Check-outs, Multiple Solution Files
Analyze andAnalyze andArchitectArchitect
Team Development TipsBeing Repeatable, Reliable, and Fast
Set up a Team Environment
Dedicate Team Hardware Resources
Choose a Web Development Model
Structure and Name Your SourcesSolutions and Projects
Manage Dependencies
Multiple Solutions
Create A Build Process – BuildIt .NET
Test TeamTest Team
Issue TrackingIssue Tracking
Test ProcessTest Process
Test Test ResultsResults
Build Build ProcessProcess
Bu
ild O
utp
ut
Bu
ild O
utp
ut
Ge
t La
tes
tG
et L
ate
st
BuildIt .NETBuildIt .NET
Set Up A Team Environment
DevelopmentDevelopment TeamTeam
ReferenceReference
Development Development ProcessProcess
Admin TeamAdmin Team
MSI PackageMSI Package
MSI PackageMSI Package
Check In,Check In, GetGet
SourceSafe SourceSafe ServerServer
Deployment Deployment ProcessProcess
Release Release ProcessProcess
Web ServicesWeb ServicesServer Server
Re
fere
nc
es
Re
fere
nc
es
Build ServerBuild Server
Database Database ServerServer
Dedicate Server Hardware Recommendations
CPU Memory Hard disk
Build PIII-class
660 MHz
96-192 MB* 600 MB sys
3 GB install
SourceSafe Pentium-class
333MHz32-256 MB(32MB min)
4-10 GB(2x db size)
TIP: Minimize network latency for speed
Database SQL Server 2000 Enterprise Edition with appropriate requirements
Web
Service
Windows 2000, XP, or Server 2003
Internet Information Services (IIS) 5 or 6
NTFS file system is recommended*Varies by OS (Window NT 4, Windows 2000, XP, 2003 Server)
Choose A Web Model
VSS
Developer 1Developer 1
Web ApplicationWeb Application
Developer 2Developer 2
Web ApplicationWeb Application
Visual Studio .NETVisual Studio .NETVisual Studio .NETVisual Studio .NET
Isolated / Local HostIsolated / Local Host
Common Web ServerCommon Web Server
Web ApplicationWeb Application Web ApplicationWeb Application
VSS
Developer 1Developer 1
Visual Studio .NETVisual Studio .NET
Developer 2Developer 2
Visual Studio .NETVisual Studio .NET
Common Web ServerCommon Web ServerVSS
Developer 1Developer 1
Visual Studio .NETVisual Studio .NET
Web ApplicationWeb Application
Developer 2Developer 2
Visual Studio .NETVisual Studio .NET
Semi-Isolated / Server HostSemi-Isolated / Server Host
Non-Isolated / Front PageNon-Isolated / Front Page RecommendedRecommended
Web Development Models
Isolated Semi-Isolated Non-Isolated
Typical access http://localhost http://server http://server
SourceSafe access File Share File Share FrontPage
UNC access needed Yes Yes No
Can work isolated Yes Yes No
Offline support Yes Yes Limited
Dedicated server No Yes Yes
Web references Automatic Use user.config Automatic
Server debugging Automatic 1 Session per machine
1 Session per machine
Recommendations Preferred Server Resources
Compatible
RecommendedRecommended
Projects (.csproj, .vbproj, etc.)
Build and configuration
settings for assembly
Web projects – created with an HTTP location http://localhost/MyWebProject
Non-Web, local projects – file system location c:\Projects\MySystem\MySolution\MyWinProject
Structure And Name Projects And Solutions
Solution files (.sln)
Groups related projects together
Contains project dependency information used by the build process for build order
DependenciesDependencies
SolutionSolution
Project AProject A
Project BProject B
Project CProject C
Manage DependenciesFiles and Project References
Use project references where possibleWork great with source control
References to paths are user-specificEach user will need to set their path up before they build the first time
To refer to a non-built or third-party dll, consider putting it on a shared folder and set the CopyLocal property = TRUE
Manage DependenciesWeb References
Web references to external services work fine
Web references to Webs within the solution require management
http://localhost users Need to ensure all their local projects are in the same place
http://server usersNeed to make their references ‘dynamic’
Each team member must have a user.config file that resolves the reference for them
Proj1Proj1
Create Multiple Solutions
c:\Projectsc:\Projects
Single SolutionSingle Solution
Solution1Solution1
Solution1.slnSolution1.sln
Proj1.csprojProj1.csproj
Master SolutionMaster Solution Multi-SolutionMulti-Solution
Web1Web1
Web1.vbprojWeb1.vbproj
Proj1Proj1
c:\Projectsc:\Projects
Solution1Solution1
Solution1.slnSolution1.sln
Proj1.csprojProj1.csproj
Proj1Proj1
c:\Projectsc:\Projects
Solution1Solution1
Solution1.slnSolution1.sln
Proj1.csprojProj1.csproj
Solution2Solution2
Solution2.slnSolution2.sln
RecommendedRecommended
Web1Web1
Web1.vbproj Web1.vbproj
Solution2Solution2
Solution2.slnSolution2.sln
Web1Web1
Web1.vbproj Web1.vbproj
Patterns & PracticesPatterns & Practices
..\Visual Studio Projects..\Visual Studio ProjectsC:\ProjectsC:\Projects
Local StructureLocal Structure
MySolutionMySolution
ClientProject1ClientProject1
BinBin
WebAppProject2WebAppProject2
BinBin
C:\inetpub\wwwrootC:\inetpub\wwwroot
$/Projects$/Projects
SourceSafe StructureSourceSafe Structure
MySolution.rootMySolution.root
MySolutionMySolution
ClientProject1ClientProject1
WebAppProject2WebAppProject2
.sln.sln
Solution default \My Documents\Visual Studio Projects
Web projects default usually \inetpub\wwwroot
Alter this default structure for a team environment
Visual Studio .NET 2003 will restructure VSS folders – adding “.root”
Create A Common Folder StructureUse the same local structure for all developers
Create Naming Conventions
Carefully consider projects, assemblies, folders, and namespaces
Output assemblies match project nameUtilities.Data.csproj Utilities.Data.dll
Assembly root namespace = project and assembly name
Use same names for SourceSafe folders and local folders
Change and delete with caution from Visual Studio .NET
Create A Build ProcessUsing BuildIt .NET
Critical element for all team development
Configure a build server as soon as possible
Build scripts are key for repeatability
Build scripts use the SourceSafe automation model or command line
Download the code to the build machine
Check-in an updated version info file
Create a label to match sources with outputs
Build scripts compile by executing Microsoft Visual Studio .NET (devenv.exe) from the command line
Source code available, so it’s fully customizable
Steps In The Build Script
Generate Generate build numberbuild number
Label SourcesLabel Sources & Retrieve& Retrieve
Create BackupCreate Backup & Archive & Archive
Errors?Errors?
Devenv.exe &Devenv.exe © to \Latestcopy to \Latest
Debug & Debug & Release Release
YesYes
Send e-mail Send e-mail with error logwith error log
Rename \LatestRename \Latestto \Brokento \Broken
Fix broken Fix broken buildbuild
Update Update BuildNumber.xmlBuildNumber.xml
Send e-mailSend e-mail
Delete BackupDelete Backup
Copy \Latest to Copy \Latest to numbered foldernumbered folder
NoNo
c:\BuildLabc:\BuildLab
SourcesSources
LatestLatest
ArchiveArchive
11
22
DebugDebug
ReleaseRelease
DebugDebug
ReleaseRelease
Success!Success!
BuildIt .NET
Alfredo Méndez
Program Manager
Visual Studio Core Team
demodemo
SourceSafe Best Practices And Tips
For Team Development
Files And Source ControlVisual Studio .NET extensions
Source-ControlledSolution .slnProject .vbproj, .cspro
jApp Config web.config,
app.configSource Files .cpp, .cs, .vb, .
aspx, .asax, .resx, .css, .h, .vsdisco, .idl
Hint Files .vssscc, .vspscc,~sak*.sln ~sak*.vbproj, ~sak*.vsproj
Not Source-ControlledUser Options
.suo
User Options
.vbproj.user, .csproj.user
Web info .vbproj.webinfo,.csproj.webinfo
Build outputs
.idl .h, many others…
Hint Files mssccprj.scc,vssver.scc
There are many files…
…Don’t Worry About Those Files!Use Visual Studio .NET and it’s automatic!
Always use Visual Studio .NET for source control Only the appropriate files are added to source control
Paired files are matched automaticallyExample: Form1.vb and Form1.resx
Visual Studio .NET project and solution files are updated with appropriate SCC-specific details
A count of projects in the solution that are under source-control (this count includes the solution itself)
SourceSafe server for each project
Location on the server for each project
Name of each project’s source-control provider
Each project's location relative to the solution file
TIP: Create a blank solution first, then add projects
Installing Visual SourceSafeSourceSafe not installed by default with Visual Studio .NET
Install on server before installing client software
Avoid NetSetup – it makes non-shareable connections
Use SourceSafe 6.0d for all users – do not mix-and-match
Secure the default database and the administration tools
Don’t create databases under the \Program Files folder
Use the 6.0 format when creating databases (faster)
Creating SourceSafe DatabasesUse separate databases for independent efforts
More precise control over user access, policy for projects
Maintenance and repair will affect a smaller group of users
Can easily archive the project’s database when project ends
Note: Single databases over 5GB in size perform poorly
Use shareable connections like \\machine\vss\srcsafe.ini
Securing SourceSafe DatabasesUse Windows Groups: all developers, plus ‘buildlab’
Windows sharing permissions: remove ‘Everyone’
SourceSafe Admin: remove ‘Destroy’ rights
Create SourceSafe accounts for each user and the build scriptSourceSafe user names should match the domain user names
Enable the ‘Use network name for automatic user login’ option
Use different passwords for SourceSafe and Windows
Create a SourceSafe Administrators Group to secure Vss\Win32
Dealing with Data CorruptionUse ‘Analyze’ once each week
Have all users log off SourceSafe before ‘Analyze -F’
Consider a fault-tolerant system such as RAID
Create tape backups of the SourceSafe database disk volume
Minimize use of unreliable network connections like RAS
SourceSafe Shadow Folders
Creates a directory on a central server
Mirrors latest contents of a SourceSafe project folder
Check-ins will auto-update the shadow
Shadow folders increase check-in timeUse with caution
Disable to improve performance
Ideal for Read-only users
Users who check-in will need write permissions to the shadow directory
Changes In Visual Studio .NET 2003
What’s New?
Visual Studio .NET 2003And Visual SourceSafe 6.0d
Reduced prompting and creation of a “.root” folder in SourceSafe when adding to source control
Elimination of temporary files (~sak) that perform a capabilities test
Additional guidance on securing your database
Other issues identified in KB 820831
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\SourceControl][HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\SourceControl] "DoNotCreateSolutionRootFolderInSourceControl"=dword:00000001"DoNotCreateSolutionRootFolderInSourceControl"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\SourceControl][HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\SourceControl] "DoNotCreateTemporaryFilesInSourceControl"=dword:00000001"DoNotCreateTemporaryFilesInSourceControl"=dword:00000001
Summary And Discussion
Closing thoughts
Summary
To be fast and maximize repeatability and reliability in teams…
Use automated builds in your processCustomize BuildIt .NET
Dedicate hardware to builds, SourceSafe
Use the isolated Web model
Spend time defining your project and solution structures
Make backups of SourceSafe disk volumes
Use several SourceSafe databases
Ask The ExpertsGet Your Questions Answered
I will be available at the “Ask The Experts” area the following times:
Wed & Thu – 12:00 to 13:00
Friday – 12:00 to 14:00
Community Resources
http://msdn.microsoft.com/ssafeCommunity Resources
http://www.microsoft.com/communities/default.mspx
Most Valuable Professional (MVP)http://www.mvp.support.microsoft.com/
NewsgroupsConverse online with Microsoft Newsgroups, including Worldwidehttp://www.microsoft.com/communities/newsgroups/default.mspx
microsoft.public.visual.sourcesafe microsoft.public.visualsourcesafemicrosoft.public.vsnet.vssmicrosoft.public.sourcesafemicrosoft.public.vs.net.ide
User GroupsMeet and learn with your peershttp://www.microsoft.com/communities/usergroups/default.mspx
Suggested Reading & Resources
Team Development with Visual Studio .NET and Visual SourceSafe
http://msdn.microsoft.com/library/en-us/dnbda/html/tdlg_rm.asp
BuildIt .NEThttp://msdn.microsoft.com/library/en-us/dnbda/html/tdlg_app.asp
Web Projects and Source Control Integration in Visual Studio .NET
http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vetchWebProjectsSourceControlIntegrationInVisualStudioNET.asp
evaluationsevaluations
© 2003 Microsoft Corporation. All rights reserved.© 2003 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.
Backup Slides…Backup Slides…
Team Domain Infrastructure
Developer Developer WorkstationsWorkstations
Dev TestDev Test
SQL ServersSQL Servers Web ServersWeb Servers
Dev TestDev Test
100MB Ethernet100MB Ethernet
Stress HubStress Hub
Stress Test Stress Test EnvironmenEnvironmen
tt
100MB Ethernet100MB Ethernet
DCDC BuildBuild BackupBackup VSSVSSMSDNMSDN
VSS ShadowVSS Shadow
Isolated DevelopmentAdvantages
Local instances of Web application
Can debug without interfering with one another
Superior support for source-code control*
Slightly faster in a local area network (LAN)*
Semi-Isolated and Non-IsolatedDisadvantages
Easy to inadvertently affect another developerExample: Debugging locks common Web server
Non-isolated: Only one code-behind DLL
FrontPage Extensions don’t support parallel development with multiple shared checkouts
Repeatable and ReliableWell-Defined Process (including Build Process)
Dedicated Resources for Version Control and Build
Well-Defined Source Code Structure
Match Source Code with Outputs (Versions,Labels)
Fast Parallel DevelopmentSymbiotic Development and Build Environments
Web Environment Team Configuration
Well-Defined Source Code Structure
Multiple checkouts and merging
Keys To Getting The Most From Team Development
[assembly: AssemblyVersion("1.0.1001.1")][assembly: AssemblyVersion("1.0.1001.1")]
Visual Studio .NETChanging Existing Web Projects
Changing Web Model Choice1. Open Project Properties
2. Open Common Properties folder, click Web Settings
3. Change Web Access Mode
Using Front Page1. Open Visual Studio .NET Tools
Options
2. Open Projects folder, click Web Settings
3. Select FrontPage Extensions
Structure: Single Solution Model
All projects are contained in the one solution
If one project needs to reference an assembly generated by another, use project references
Use file references only to reference outer-system assemblies that are not built with the rest of your system
Inner System Inner System BoundaryBoundary
ProjectProjectAA
ProjectProjectBB
ProjectProjectCC ProjectProject
DD
ProjectProjectEE
Outer System Outer System BoundaryBoundarySolution 1Solution 1
ExternalExternalAssembliesAssembliesThird-PartyThird-Party
ComponentsComponents
File referenceFile reference
Project referenceProject reference
Structure: Master Solution ModelPartitioned Single Solution
All projects are contained in a master solution
Project references are used between individual projects
Separate solution files are introduced for selected project files containing any downstream project it depends on
Inner System Inner System BoundaryBoundary
ProjectProjectAA
ProjectProjectBB
ProjectProjectCC
ProjectProjectDD
ProjectProjectEE
Outer System Outer System BoundaryBoundary
Master Master SolutionSolution
ExternalExternalAssembliesAssembliesThird-PartyThird-Party
ComponentsComponents
File referenceFile reference
Project referenceProject reference
ProjectProjectHH
ProjectProjectFF
ProjectProjectGG
SolutionSolution
Solution 3Solution 3
Solution 2Solution 2
ProjectProjectDD
ProjectProjectEE
Structure: Multi-Solution Model
No master solution file
File references are used between projects in separate solutions
The system build script that runs on the build server builds each solution in turn, based on known dependency relationships
Inner System Inner System BoundaryBoundary
Outer System Outer System BoundaryBoundary
ExternalExternalAssembliesAssembliesThird-PartyThird-Party
ComponentsComponents
Solution 1Solution 1
ProjectProjectAA
ProjectProjectBB
ProjectProjectCC
ProjectProjectFF
File referenceFile reference
Project referenceProject reference
RecommendedRecommended