Delphi 项目 Build Configurations 构建配置 .DPROJ 文件
一、工程项目 构建配置-基础:调试,发行 ( Build Configurations - Base: Debug, Release )
每一个工程项目,都需要建立 Build Configurations,其构成的基础是:调试Debug和发行Release。
这二个配置,一个是调试方式Debug,一个是发行方式Release,进行编译。
当您需要在那个方式编译,鼠标右键战场Activate即可。
上述菜单中,可以生成、创建、清理Configuration。
相关配置Configuration,保存在工程目录中的.dproj文件中。
二、.DPROJ文件
由Delphi 开发时,由IDE创建的项目(对象)文件;
.DPROJ文件使用XML格式,用作开发项目的保存和加载格式,包含源代码文件引用、编译器和链接器设置、项目目录和其他项目设置,它保存的中IDE环境参数和Project工程参数,即编译器的环境参数,最终编译生成.EXE 、.DLL 或.OCX 文件。
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{83E41B5D-C35E-4E30-9B7B-DCF313DC125A}</ProjectGuid>
<ProjectVersion>19.0</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<MainSource>Project1.dpr</MainSource>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<SanitizedProjectName>Project1</SanitizedProjectName>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;FlexCel_Pdf;vclactnband;FMX_FlexCel_Core;vclFireDAC;fsDB27;bindcompvclsmp;emsclientfiredac;DataSnapFireDAC;tethering;svnui;FireDACADSDriver;frx27;DBXMSSQLDriver;fsTee27;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;unidac270;vcltouch;vcldb;bindcompfmx;svn;SKIA_FlexCel_Core;DBXOracleDriver;FlexCel_Report;frxIBX27;inetdb;crcontrols270;uSynEdit_R2023;RaizeComponentsVcl;fs27;FmxTeeUI;emsedge;RaizeComponentsVclDb;FireDACIBDriver;fmx;fmxdae;VCL_FlexCel_Components;vcledge;vclib;uniGUI27Chart;uniGUI27m;FireDACDBXDriver;dbexpress;IndyCore;vclx;frxTee27;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;EhLibADODataDrivers270;dacfmx270;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;frxDB27;vcl;DBXSybaseASEDriver;IndyIPServer;EhLib270;dacvcl270;IndySystem;vquery270;FireDACDb2Driver;dac270;aceDX10Sydney_R;dsnapcon;EhLibIBXDataDrivers270;FireDACMSAccDriver;FireDACInfxDriver;fmxFireDAC;vclimg;frxIntIOIndy27;TeeDB;FireDAC;FlexCel_XlsAdapter;fsIBX27;unidacfmx270;emshosting;frxIntIO27;AlphaDBDX10Sydney;uniGUI27VCL;acntDX10Sydney_R;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;FlexCel_Core;GRDelphi;ibxpress;Tee;DataSnapServer;xmlrtl;DataSnapNativeClient;ibxbindings;fmxobj;FireDACDSDriver;soapmidas;rtl;emsserverresource;DbxClientDriver;vclwinx;DBXSybaseASADriver;CustomIPTransport;vcldsnap;unidacvcl270;bindcomp;appanalytics;frxADO27;DBXInformixDriver;IndyIPClient;fsADO27;bindcompvcl;frxe27;TeeUI;FMX_FlexCel_Components;dbxcds;VclSmp;VCL_FlexCel_Core;adortl;FireDACODBCDriver;frxDBX27;FlexCel_Render;DataSnapIndy10ServerTransport;frxcs27;EhLibDBXDataDrivers270;DataSnapProviderClient;dsnapxml;dbrtl;FireDACMongoDBDriver;IndyProtocols;inetdbxpress;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
历史变更:
Delphi7之前无此文件;
Delphi2006之前,后缀名.BDSPROJ,从Delphi2007起改名.DPROJ。
三、.DPROJ文件功能
正因为.DPROJ文件保存了IDE环境参数和Project工程参数,编译工程时,常常因为Delphi升级(控件的升级)造成IDE环境与.DPROJ文件不一致,造成编译工程出错。
四、.DPROJ文件的修改
1、删除.DPROJ文件,打开工程项目后,通过project-option和Tool-option二项菜单设置环境和工程项目参数。编译或保存时,新建一个.DPROJ文件。比较费事,各项参数都要设置。
对的修改,既对配置Configuration的设置,在通过鼠标右键点击cefpbuild Configuration打开快捷菜单,选择Edit...
打开Project option 对话框:
2、新建一个空白工程项目,注意新建的窗口类型一定要相符,新项目建立的同时,.DPROJ文件立即生成,不规则手工修改相关参数,换名覆盖原.DPROJ文件。
五、手工修改.DPROJ文件
(1)新建 一个项目Project1。
(2)用编辑软件,将Project1.dproj文件中的“Project1”,全部替换为的原项目名。
例如:Project1替换为MyName。(注:原EXE文件名:MyName.exe)
(3)Project1.dproj更换名为“MyName.dproj”。
(4)新的dproj,覆盖原dproj文件。
打开项目,编译通过。为此,专门编写一个小程序,用于修改dproj:
大约修改替换5-10处,即可使用。
注意,再打开工程项目时,另一个需要修改的是:Output directory
因为,大多数项目都有,读取相关目录,Output directory很重要。
以上仅个人经验,欢迎批评指正。