Sams Teach Yourself .Net in 21 Days
- Table of Contents
- Copyright
- About the Author
- About the Technical Editor
- Acknowledgments
- We Want to Hear from You
- Introduction
- Week 1: At a Glance
- Day 1. Introduction to the Microsoft .NET Framework
- Day 2. Introduction to Visual Studio .NET
- Day 3. Writing Windows Forms Applications
- Day 4. Deploying Windows Forms Applications
- Day 5. Writing ASP.NET Applications
- Day 6. Deploying ASP.NET Applications
- Day 7. Exceptions, Debugging, and Tracing
- Week 1. In Review
- Week 2: At a Glance
- Day 8. Core Language Concepts in Visual Basic .NET and C#
- Day 9. Using Namespaces in .NET
- Day 10. Accessing Data with ADO.NET
- Day 11. Understanding Visual Database Tools
- Day 12. Accessing XML in .NET
- Day 13. XML Web Services in .NET
- Day 14. Components and .NET
- Week 2. In Review
- Week 3: At a Glance
- Day 15. Writing International Applications
- Day 16. Using Macros in Visual Studio .NET
- Day 17. Automating Visual Studio .NET
- Day 18. Using Crystal Reports
- Day 19. Understanding Microsoft Application Center Test
- Day 20. Using Visual SourceSafe
- Introducing Visual SourceSafe
- Installing VSS
- Using the Visual SourceSafe Administrator
- Using the Visual SourceSafe Explorer
- Creating Your First VSS Project
- Using the Integrated SourceSafe Tools in Visual Studio .NET
- Viewing the History of a File in SourceSafe
- Opening an Existing SourceSafe Project
- Adding New Project Items or Projects
- Renaming Projects or Project Items
- Summary
- Q&A
- Quiz
- Exercises
- Day 21. Object Role Modeling with Visio
- Week 3. In Review
Renaming Projects or Project Items
Renaming items in a project under source control is not much more difficult than adding new items. Remember that you're always working with a local copy of the data, so any change you make on the local copy must be reflected in the VSS database. If you have an item in your solution and you need to rename it, the first step is to check the file back in. After the file is checked in, you can right-click the file and rename it as you normally would. At this point, you're prompted to check out the project file because it must be updated with the new filename. After you check out the project and rename the item, the renamed item appears as a checked-out file in the Solution Explorer. At this stage, the original file still exists with the original filename in VSS. After you check in the renamed file to VSS, a new item with new history is created. The original file remains intact. To see this in action, you can rename a file and then look at the SourceSafe Explorer. In Figure 20.19, I renamed Form1.vb to FirstForm.vb in the Visual Studio .NET IDE. This caused me to check the renamed file into SourceSafe, thus creating two versions of the file.
Figure 20.19 SourceSafe Explorer after renaming a file from Visual Studio .NET.
Because the project file was updated to reflect the name of the newly renamed file, it is the only one to show up in the project. The original file remains in SourceSafe forever or until you delete it.
The recommended way to rename a file is to first rename the file in the SourceSafe Explorer. After the file is renamed in SourceSafe, you can select Get Latest Version of the File from Visual Studio .NET. At this point, the file is read-only from SourceSafe using your local copy. You can now rename the file to the same name you used in the SourceSafe Explorer. SourceSafe attempts to check the file out. When prompted, you should check out the file as you would normally. Because the local file version detects that the file has been changed in SourceSafe, you're prompted on a course of action to take with this file. If you select Continue from the warning dialog, the renamed file will be read-only in the Solution Explorer and it will match the version stored in SourceSafe.
This can become a little confusing if you're working with a team of developers and people are always renaming files. The best way to make sure that you aren't losing any information or any of your work is not to allow multiple checkouts. As a result, the only person affected by a change is the person who actually renames the file. After you check in your files, you can get the latest versions of the files from the server and your project is up to date.
Summary | Next Section

Account Sign In
View your cart