Так же как и решения, проекты хранят информацию о своей структуре внутри файла. Эти файлы имеют различные расширения (в зависимости от базового языка). В табл. 4.3 показаны различные расширения, которые Visual Studio использует для идентификации файлов проектов.
Каждый файл определения проекта содержит всю необходимую информацию для описания исходных файлов, а также по различным свойствам проекта и опциям, в том числе:
□ конфигурации сборки;
□ ссылки на проекты и зависимости;
□ местоположение исходных файлов кода и их типы.
Файлы определения проекта для языков Visual Basic и Visual C# подчиняются одной схеме. В листинге 4.2 показан фрагмент файла определения проекта на языке Visual С#.
<Project DefaultTargets="Build"
xmlns="
<Configuration Condition=" ^(Configuration)' == ''">Debug</Configuration> <Platform Condition=" 1 $(Platform) ' == 11 ">AnyCPU</Platform> <ProductVersion>8.0.50215</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E22301F1-5AD6-4514-A05D-266158AB1CAB}</ProjectGuid> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WindowsApplication2</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition^" 1 $(Configuration) |$(Platform) ' == 'Debug|AnyCPU
">
<DebugSymbо1s>true</DebugSymbо1s>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBLJG;TRACE</DefineConstants>
\
<ErrorReport>prompt</ErrorReport>
<WarningLeve1>4</WarningLeve1>
</PropertyGroup>
<PropertyGroup
Condition^" '$(Configuration) I $(Platform) 1 “'Release I AnyCPU' "> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Xnclude="Forml.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forml.Designer.cs">
<DependentLJpon>Forml. cs</DependentUpon>
</Compile>
<Compile Include^"Program, cs" />
<Compile Include^"Properties\AssemblyInfо.cs" />
<EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include=MProperties\Resources.Designer.cs"> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
Этот файл определения проекта будет выглядеть примерно одинаково как в проекте на языке Visual Basic, так и в проекте на Visual J#. Однако в файлах проекта на Visual C++ используется совершенно другая схема. Для полноты и для сравнения с Visual Basic/Visual C# в листинге 4.3 полностью показан экземпляр файла определения проекта на Visual C++.
<?xml version="l.0" encoding="Windows-1252"?>
<VisualStudioProj ect
ProjectType="Visual C++"
Version="8.00"
Name="Contoso.Fx.UI.BrowserShim"
ProjectGUID="{BE574BF5-7FDA-46F2-A42E-4A35E5E338A0}" RootNamespace=nContosoFxUIBrowserShim"
Keyword="MFCActiveXProj"
SignManifests="true">
<Platforms>
<Platform Name="Win32" />
</Platforms >
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="2"
UseOfMFC="2" CharacterSet="l">
<Tool Name="VCPreBuildEventTool" />
<Tool Name="VCCustomBuildTool" />
<Tool Name="VCXMLDataGeneratorTool" />
<Tool Name="VCWebServiceProxyGeneratorTool" />
<Тоо1
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TypeLibraryName="$(IntDir)/$(ProjectName).tlb" HeaderFileName="$(ProjectName)idl.h" ValidateParameters="false"
/>
<Tool
Name="VCCLCompilerTool"
0ptimization="0"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL" Minima lRebuild="true"
BasicRuntimeCheскs="3"
RuntimeLibrary="3"
T reatWCha r_tAsBui11InType="t rue" UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebuglnformationFormat="4"
/>
<Tool Name="VCManagedResourceCompilerTool" />
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool Name="VCPreLinkEventTool" />
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
OutputFile="$(OutDir)\$(ProjectName).ocx"
Linklncremental="2"
i
ModuleDefinitionFile=".\Contoso.Fx.UI.BrowserShim.def" GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="l"
/>
<Tool Name="VCALinkTool" />
<Tool Name="VCManifestTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
<Tool Name="VCFxCopTool" />
<Tool Name="VCAppVerifierTool" />
<Tool Name="VCWebDeploymentTool" />
<Tool Name="VCPostBuildEventTool" />
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory^"Release"
IntermediateDirectory="Release"
ConfigurationType="2"
Use0fMFC="2"
CharacterSet="l"
>
<Tool Name="VCPreBuildEventTool" />
<Tool Name="VCCustomBuildTool" />
<Tool Name="VCXMLDataGeneratorTool" />
<Tool Name="VCWebServiceProxyGeneratorTool" />
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions-"NDEBUG"
MkTypLibCompatible="false"
TypeLibraryName="$(IntDir)/$(ProjectName).tlb" HeaderFileName="$(ProjectName)idl.h" ValidateParameters="false"
/>
<Tool
Name="VCCLCompiIerTool"
0ptimization="2"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL" MinimalRebuild="false"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="true"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInfomationFormat="3"
/>
<Tool Name="VCManagedResourceCompilerTool" />
<Тоо1
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool Name="VCPreLinkEventTool" />
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
OutputFile="$(OutDir)\$(ProjectName).ocx"
Linklncremental="1"
ModuleDefinitionFile=".\Contoso.Fx.UI.BrowserShim.def" GenerateDebugInformation="true"
SubSystem="2"
0ptimizeReferences="2"
EnableC0MDATFolding="2"
TargetMachine="1"
/>
<Tool Name="VCALinkTool" />
<Tool Name="VCManifestTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
<Tool Name="VCFxCopTool" />
<Tool Name="VCAppVerifierTool" />
<Tool Name="VCWebDeploymentTool" />
<Tool Name="VCPostBuildEventTool" />
</Configuration>
</Configurations>
<References></References>
<Files>
<Filter Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Uniqueldentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> <File RelativePath=" . \Contoso. Fx. UI. BrowserShim. cpp"x/File> <File RelativePath=".\Contoso.Fx.UI.BrowserShim.def"></File> <File RelativePath=" . \Contoso. Fx.UI .BrowserShim. idl"x/File> <File RelativePath=".\Contoso.Fx.UI.BrowserShimCtrl.cpp"> </File>
<File RelativePath=".\Contoso.Fx.UI.BrowserShimPropPage.cpp">
</File>
<File RelativePath=".\stdafx.cpp">
<FileConfiguration Name="Debug|Win32" >
<Tool Name="VCCLCompiIerTool"
UsePrecompiledHeader="l" />
</FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VCCLCompiIerTool"
UsePrecompiledHeader="l" />
</FileCorifiguratipn>
</File>
</Filter>
<Filter.
Name="Header Files"
Filter="h;hpp;hxx;hm;ini;inc;xsd"
Uniqueldentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File RelativePath=".\Contoso.Fx.UI.BrowserShim.h"x/File>
<File RelativePath=".\Contoso.Fx.UI.BrowserShimCtrl.h"x/File>
<File RelativePath=".\Contoso.Fx.UI.BrowserShimPropPage.h">
</File>
<File RelativePath=". \Resource.h"x/File>
<File RelativePath=". \stdafx. h"x/File>
</Filter>
<Filter Name="Resource Files"
Filter "rc;ico;cur;bmp;dig;rc2;ret;bin;rgs;gi f;jpg;j peg;j pe;resx;ti f f; ti f; png; wav"
Uniqueldentifier="{67DA6AB6-F800-4c08-8B7A-83BB12lAAD01}">
<File RelativePath=".\Contoso.Fx.UI.BrowserShim.ico"x/File>
<File RelativePath=" . \Contoso. Fx.UI.BrowserShim. rc"x/File>
<File RelativePath=".\Contoso.Fx.UI.BrowserShimCtrl.bmp"x/File>
</Filter>
<File RelativePath=" . \ReadMe. txt"x/File>
</Files>
<Globalsx/Globals>
</VisualStudioProject>