E.2 Project FilesEach project's settings are stored in one or more project files. Different project types have their own file formats, and some even create many different files to store a single project's properties. The four language project types, C#, J#, VB.NET, and C++, each has its own file extension (.csproj, .vjsproj, .vbproj, and .vcproj, respectively). However, despite having different extensions, these files all use the same basic format—they are all XML files with a common schema. As well as storing project properties, these files also contain the list of references to other assemblies. The following is an example of the XML for a references list: <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> <Reference Name = "BusObj" Project = "{D045135B-9113-44CB-8E73-971DDF807358}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> </References> Although these references evidently contain relative paths to the system DLLs, VS.NET is robust in the face of relocated projects. If you change the location of a project on the filesystem, this will break the relative paths. However, when this happens, VS.NET searches to find the files again, using a heuristic that will find them quickly in most cases. The final Reference element in this snippet is a project reference. Note how it uses the referenced project's GUID to identify the project rather than a path to the project file. This makes such references entirely location independent—if you move a project, VS.NET doesn't even have to rely on a heuristic to work out whether the project in the new location is the same one that used to be in the previous location. (Of course, you will have to update any solutions that contain this project so that they know the new location of the project file. But you will not have to re-create any project references.) This file also saves the information about the project's files. See Chapter 2 for more information about managing files in projects. E.2.1 User FilesC#, J#, and VB.NET projects also create a second project file. It will have the same name as the main project file, with .user added to the end (e.g., MyProject,csproj.user). This file keeps certain projectwide user-specific properties. Its relationship to the project settings file is similar to the .suo file's relationship to the .sln file—again, it contains settings that affect the IDE's operation but that have no impact on the build output. (These settings affect the way the program is executed and debugged, but not how it is built.) When you tell VS.NET to add a project to a source control database, it will omit this file, allowing each developer to have her own .user file. This allows each of the developers working on the same project to modify the debug settings without affecting other members of the team. E.2.2 Web FilesFor web-based C# and VB.NET projects, there is an additional project file named <projectname>.webinfo. This file contains XML of the following form: <VisualStudioUNCWeb> <Web URLPath = "http://localhost/WebUI/WebUI.vbproj" /> </VisualStudioUNCWeb> The Web element has one attribute—URLPath—which points VS.NET to the correct URL for this web project. |