1 / 44

Agenda

Team Development of ASP.NET Projects Using Visual Studio .NET and Visual SourceSafe Anand M. Hegde Support Engineer Microsoft Developer Support Microsoft Corporation. Agenda. Introduction to Team Development Understanding Solutions and Web Projects

Mia_John
Télécharger la présentation

Agenda

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Team Development of ASP.NET Projects Using Visual Studio .NET and Visual SourceSafeAnand M. HegdeSupport Engineer Microsoft Developer Support Microsoft Corporation

  2. Agenda • Introduction to Team Development • Understanding Solutions and Web Projects • Working with Microsoft® Visual SourceSafe® • Web Development Models • Deploying Web Projects • Team Development Best Practices • Frequently Asked Questions • Additional Resources

  3. Introduction to Team Development • A collaborative effort to increase productivity and efficiency • Rapid development of complex projects • A must for an enterprise scenario • Key elements: • Coordination and well defined roles • Microsoft Visual Studio® .NET • Microsoft Visual SourceSafe • Isolated environment for parallel development

  4. Understanding Solutions and Web Projects • What are solutions? • Solutions are containers for one or more projects • Solutions cannot contain other solutions • Solutions are stored locally • Solutions contain information such as: • List of projects contained • Dependency between projects • Project build order • Source control provider details • Solutions have a .sln extension

  5. Understanding Solutions and Web Projects (2) • What are Web projects? • Projects created with an HTTP location • Templates for Web-based applications • Can be contained in multiple solutions • Have a .vbproj extension for Visual Basic® .NET projects, and a .csproj extension for Visual C#™ projects • Typically contain the following types of files: • .config – configuration files • .vb, .cs – code-behind files • .aspx – Web Form files • .resx – resource files • .asax – global configuration file • .asmx – XML Web Service file

  6. Understanding Solutions and Web Projects (3) • Visual Studio .NET automatically adds required files to source control when working with Visual SourceSafe (VSS) • Files automatically added to source control: • *.sln – solution files • *.vbproj and *.csproj – project files • *.config files – configuration files • *.vb, *.cs, *.aspx, *.asmx, *.resx, *.asax, *.vsdisco, etc. – source files

  7. Understanding Solutions and Web Projects (4) • Files automatically excluded from source control: • *.suo – solution user options files • *.vbproj.user, *.csproj.user – project user options files • *.csproj.webinfo, *.vbproj.webinfo – Web information files • Build Outputs, .DLLs, Interop assemblies, third-party assemblies and Bin folder • Note: You must manually add the required third-party assemblies/Interop assemblies to source control

  8. Web Access Methods in Visual Studio .NET • File share Web access method • Web projects are created and managed using a combination of direct file access and HTTP access • Offers rich source control support • Default for Visual Studio .NET • Microsoft FrontPage® Web access method • Web projects are created using HTTP protocol and FrontPage server extensions • Limited source control support • To change access method in Visual Studio .NET IDE: • On the Tools menu, click Options, click Projects, and then click Web Settings

  9. About References in .NET • Reference an assembly to use the types contained in it • Project references • Reference to other projects in the same solution • Provide hassle free automatic versioning • Help avoid the problem of missing references • Prevent circular dependencies • Switch from debug to release build without resetting references

  10. About References in .NET (2) • File references • Use when you cannot use project references • Ideal for referencing system and third-party components • Web references • Used to reference XML Web Services

  11. Dynamic URL Web References • Web references are stored statically so you cannot share them among team members while using non-local projects • Work around this limitation by converting the static Web reference URLs in the Web.config file to a dynamic property • Highlight the Web reference and change the URL behavior property from static to dynamic • Add a file named User.config to your project and add the following code: <?xml version="1.0" encoding="utf-8" ?> <appSettings> <add key="WebApp.server.service" value="http://localhost/WebService/Service1.asmx"/> </appSettings>

  12. Dynamic URL Web References (2) • In the Web.config file, change: <appSettings> <add key="WebApp.server.service" value="http://Server/WebService/Service1.asmx"/> </appSettings> To: <appSettings file=“User.config”> </appSettings> • Now the setting in User.config is used instead of the one in the Web.config • Each team member should create his own User.config file • Do not check this file in to VSS • The same instructions apply to storing database ConnectionStrings

  13. Structuring Solutions and Projects • Consider appropriate structuring based on size and nature of project • Typically three models exist • Single solution model • Partitioned single solution model • Multi-solution model • Carefully select the right model for you

  14. The Single Solution Model External / Third Party Components • All the projects are contained in one solution • All projects in the solution use project references • Projects use file references for external assemblies or third-party components • Has significant advantages over other models • Use it all the time if possible (it is the recommended model) Outer Boundary Inner Boundary Solution 1 Proj B Proj C Proj A Proj D Proj E File Reference Project Reference

  15. The Single Solution Model(2) • Advantages • Easy to manage and has a simple structure • Can use project references • Assembly versioning issues avoided • Easy switch from debug to release builds • Disadvantages • Must get the source for all the projects even though you are working on a single project • Simple changes may require rebuilding many dependent projects • When do you use it? • Whenever possible!

  16. Partitioned Single Solution Model External / Third Party Components • All projects are included in the master solution • Some projects (and their dependent projects) are added to separate smaller solutions • Separate solution files permit you to work on smaller subsystems of your application • You still use project references Outer Boundary Main Solution Inner Boundary Proj A Proj B Proj C Solution Proj E Proj D Proj F Solution Solution File Reference Project Reference

  17. Partitioned Single Solution Model (2) • Advantages • Can work on smaller subsystems • Can use project references • Can rebuild the whole system using the master solution • Easy to write build scripts • Disadvantages • Must update multiple solutions while adding/deleting projects • Partition is limited by the project dependencies • When do you use it? • When the application is very large • When you want to reduce the number of files per individual development workstation

  18. The Multi-Solution Model External / Third Party Components • There is no master solution • Application is spread across multiple solutions • Can still use project references in a solution • Must use file reference to reference projects in different solution • Not really recommended Outer Boundary Proj C Inner Boundary Solution 3 Proj F Proj B Proj A Proj D Proj E Solution 1 Solution 2 File Reference Project Reference

  19. The Multi-Solution Model (2) • Advantages • Can easily add/remove projects from a solution • Can divide the system logically instead of using project dependencies • Disadvantages • Build process is made more difficult because of file references between projects • Forced to reference a specific build of a DLL explicitly (for example, debug or release build) • Difficult to conduct local integration testing • When do you use it? • Only when necessary

  20. Working with Visual SourceSafe • Install Visual SourceSafe Server 6.0c from Visual Studio .NET Enterprise Architect CDs, and then share the installation folder with Read Only rights • Install the VSS client from the share mentioned earlier using Netsetup.exe • Manage VSS databases using Ssexp.exe • Manage users and options using Ssadmin.exe • Quick terminology • Check-in – save the modified file to VSS • Check-out – get the file for editing • Multiple-checkout – multiple developers can edit the file at the same time (option available from VSS Administrator tool) • Merging – synchronize the local copy with the version in the VSS database

  21. Web Development Models • Different methods are available to develop Web applications in a team environment • Three models exist: • Isolated development model • Semi-Isolated development model • Non-Isolated development model • Select the right model to suit your environment

  22. Isolated Development • Projects are created and developed locally • Use File Share Access method • VSS client is installed on developers’ boxes • Use Visual Studio .NET IDE to interact with VSS • True parallel development • The recommended model Developer1 Developer2 Web App Web App VS.NET VS.NET VSS

  23. Isolated Development (2) • Advantages • Easy to create and manage Web references • Offers true parallel development and debugging • Reasonable cost when compared to other models • Supports advanced source control commands like multiple checkouts, merge, branch, and label • Works with any MSSCCI-complaint source control provider • A little faster in the LAN environment • Disadvantages • Require IIS on local box, and developers must be familiar with IIS • All developers must have access to the same LAN or VPN • Testing may not be realistic in some cases • When do you use it? • Whenever possible! (it is the recommended model)

  24. Setup Isolated Development • Creating a source controlled project in Visual Studio .NET • Change the Web access method to file share • Create a blank solution in the chosen folder • Add a new Web project to the solution and provide the path as http://localhost/projectName • Right-click the solution and select “Add Solution to Source Control” • Follow the steps to log on to the source control database, then create a root solution folder, and then create a project folder under the solution folder

  25. Setup Isolated Development (2) • Opening a source controlled project for the first time • On the File menu, click Source Control, and then select “Open from Source Control” • Select the solution from the source control and then click OK • Provide the working location as http://localhost/projectName • Note: To open the project after the first time, use the Open Project command

  26. Semi-Isolated Development Common Web Server • Projects are created on the common Web server • Working copy of each developer is stored separately on the shared server • Use File Share Access method • VSS client is installed on developers’ boxes • Use Visual Studio .NET IDE to interact with VSS • Does not require IIS on the local box Web App1 Web App2 Developer1 Developer2 VS.NET VS.NET VSS

  27. Semi-Isolated Development (2) • Advantages • Cost-effective from a hardware and licensing perspective • Not necessary to have IIS on local box • Supports all source control features as an isolated model • Can be used with any MSSCCI-compliant source control provider • Disadvantages • Only one person can debug at one time, and that will also prevent others from accessing all the other Web projects • Cannot easily share Web references • All developers need access to same LAN or VPN • When do you use it? • When development machines cannot have IIS • When specific server resources are only available on the common server (for example, Microsoft .NET Passport development)

  28. Semi-Isolated Development (3) • Creating a source controlled project in Visual Studio .NET • Change the Web access method to file share • Create a blank solution in a folder • Add a new Web project to the solution and provide the path as http://servername/projectName_YourInitial • Right-click the solution and select “Add Solution to Source Control” • Follow the steps to log on to the source control database, then create a root solution folder, and then create a project folder under the root solution folder

  29. Semi-Isolated Development (4) • Opening a source controlled project for the first time • On the File menu, click Source Control, and then select “Open from Source Control” • Select the solution from the source control and then click OK • Provide the working location as http://servername/projectName_YourInitial • Note: To open the project after the first time, use the Open Project command

  30. Non-Isolated Development • Projects are created on the server • Everyone modifies the master copy, which is stored on the shared server • Mostly serial development • Uses FrontPage Access method • Configure the project to be under source control using IIS • Cannot add the project to source control using IDE • Does not require IIS on developer workstations VSS Common Web Server Common Web Application Developer1 Developer2 VS.NET VS.NET

  31. Non-Isolated Development (2) • Advantages • Developers do not require access to LAN or VPN • Disadvantages • Multiple check-outs not permitted • Developers can easily overwrite others’ changes • Cannot add a project to source control using Visual Studio .NET IDE; must use IIS • Very limited source control features • Can only be used with Visual SourceSafe • Projects must be saved on an NTFS file system partition • Anyone with administrator access to the project can enable or disable source control • When do you use it? • Not recommended – use it only when the developers do not have access to LAN or VPN

  32. Non-Isolated Development (3) • Creating a source controlled project in Visual Studio .NET • Change the Web access method to FrontPage • Create a blank solution in a folder • Add a new Web project to the solution and provide the path as http://servername/projectName • Open IIS Manager on the Web server • If you are using FrontPage 2000 Server Extensions: • Go to the properties of the project that you created • Click the FrontPage Server Extensions tab, set “Version Control” to “External”, and then click OK on all the dialog boxes • Note: If you do not have the “External” Option, read Q296715, “External Option Is Not Available After You Install Visual SourceSafe”

  33. Non-Isolated Development(4) • If you are using FrontPage 2002 Server Extensions: • Go to the properties of the default Web site, click the “Server Extension 2002” tab, and then click Settings • Click Administration on the Change Configuration Settings page • On the Server Administration page, click the default Web site • On the Site Administration for Server page, select the appropriate Subweb name • On the “Website Administration for Web Project” page, click “Configure version control” • On the “Configure version control” page, select “Use external version control (Visual SourceSafe Only)” option, type the name of the project after “$/”, and then click “Submit” Note: If the “Use External” option does not appear, read articles Q296715 and/or Q171116

  34. Non-Isolated Development(5) • Opening a source controlled project for the first time • On the File menu, click Open, and then select “Project from Web” • Provide the location as http://servername/projectName • If the “Web Access Failed” dialog box appears, click “Try to open the project with FrontPage Server Extensions” • Note: To open the project after the first time, use the Open Project command

  35. Which Model Is Right For You? Can each developer have Access to LAN / VPN? Do they have IIS and other resources on local box? Yes Yes Use Semi-Isolated Model Use Isolated Model Use Non-Isolated Model No No Add project to VSS using Visual Studio .NET IDE Add project to VSS using IIS VSS

  36. Team Development Setup • Common requirement • Source control server with VSS 6.0c • Isolated model • Workstations – IIS, Visual Studio .NET, and VSS 6.0c client • Staging server (optional) – IIS • Semi-Isolated Model • Workstations – Visual Studio .NET and VSS 6.0c client • Web server – IIS, Visual Studio .NET server components (Web development and remote debugging) • Non-Isolated Model • Workstations – Visual Studio .NET and VSS client • Web server – IIS with FrontPage Server Extensions configured,Visual Studio .NET server components (Web development and remote debugging), and VSS 6.0c client or server

  37. Deploying Web Projects • Copy Project command from Visual Studio .NET IDE • Get the latest version of the project files from the source control and build the project • Select the Project\Copy Project command • Provide the deployment location and the method of deployment, and then click OK • X-Copy method • Get the latest version of the project files from the source control and build the project • Copy necessary files to the Web server • Create a virtual folder in IIS manager to point to your project files

  38. Deploying Web Projects (2) • Web setup projects • Create a Web setup project • Add the required project to the same solution • Get the latest version of the files and build it • Right-click Web Setup Project, select “Add project output”, and select the Web project • Build the Web setup project • Copy the generated setup files to the staging/production server • Install the MSI packageNote: By default, you can install only the Web project on the default Web site

  39. Team Development Best Practices • Always keep the project folder structure the same as the one in source control. This can be easily done by creating the blank solution first at the chosen folder. • Do not change the Web access method once a project is open • Always get the latest version before you check in your file • Use multiple-checkouts wherever possible • While using File Share Access method, always use Visual Studio .NET IDE to perform any source control operation

  40. Team Development Best Practices (2) • Use Dynamic URL references when possible • Always create your projects on an NTFS partition • While using the FrontPage Access method, use “Use External” source control option instead of built-in option • Use the Isolated model – avoid the Semi-Isolated and Non-Isolated development models if possible • Do not put the working copy of the solution file on the IIS Server

  41. Frequently Asked Questions • Can I use VSS 6.0 with Visual Studio .NET? • Although you may be able to use it, it is not recommended because VSS 6.0 was released well before Visual Studio .NET, so it was not designed to work with it. • How can I debug non-isolated or semi-isolated Web applications while offline? • Make sure you have IIS on the local box. • Select Project/Web Project and then select Work Offline. • Now you can debug.

  42. Frequently Asked Questions (2) • Which development model should I use when not all the developers have access to the same LAN/VPN? • Use the Non-Isolated development model. • Can I create Web projects (using File Share method) on a virtual Web site on a remote box and then add it to VSS? • Yes and no. You can create projects on a virtual Web site, but you cannot add it to VSS when using the Semi-Isolated model.

  43. Additional Resources • Web Projects and Source Control Integration in Visual Studio .NET • Team Development with Visual Studio .NET and Visual SourceSafe • Q307467, “HOW TO: Create an ASP.NET Application from Multiple Projects” • Q317941, “PRB: FrontPage Web Projects Are Only Partially Under Source Code” • Deploying Web Projects in .NET

  44. Thank you for joining today’s Microsoft Support WebCast. For information about all upcoming Support WebCasts, and access to the archived content (streaming media files, PowerPoint® slides, and transcripts), visit: http://support.microsoft.com/webcasts/ Your feedback is sincerely appreciated. Please send any comments or suggestions about the Support WebCasts to supweb@microsoft.com.

More Related