CodeFluent Entities Documentation
CodeFluent Meta Compiler
See Also Send comments on this topic.
CodeFluent Entities > Development Tools > CodeFluent Meta Compiler

Glossary Item Box

You can invoke the meta compiler (a.k.a. builder) tool by typing the name of its executable file (CodeFluent.Build.exe) on the command line. The meta compiler tool generates ready to use components from a CodeFluent model which defines the business logic of your application as well as the defined producers which will actually generate the components. To do so, the tool starts by building a meta-model of your business logic, which will then be translated by each defined producer into platform specific code.

CodeFluent models may contain environment variables (%CF_CURRENT_PATH%, %CF_TEMPLATES_PATH%, etc.). If those environment variables are missing on your machine the build process won't complete. In such cases, you must either define the environment variables on your machine, or you must run cfvars.bat to set the appropriate environment variables to support command line builds. For more information about cfvars.bat, see CodeFluent Variables Script.

To build from the development environment, see the Microsoft Visual Studio Integration in the Tutorials, or the Industrializing the Production Process article.

For the Core Edition the CodeFluent.Build.exe executable is usually located in the SoftFluent\CodeFluent\[BuildNumber] folder under the program files folder, or in the SoftFluent\CodeFluent\Current folder under the program files folder, if it's the last installed build. Multiple versions of this executable will be present on the computer if more than one version of CodeFluent is installed on the computer. For more information about such installations, see Use Different builds of CodeFluent Entities Side-By-Side. CodeFluent.Build.exe is shipped as a 32-bit application. However it runs fine on 64-bit platforms (in WOW mode) and allows you to create 32-bit and 64-bit applications.

For the Modeler Edition the same CodeFluent.Build.exe executable is usually located in the SoftFluent\CodeFluent\Modeler folder under the program files folder. For this edition, a 64-bit native version of CodeFluent.Build.exe is also shipped, located in the SoftFluent\CodeFluent\x64 folder under the program files folder. When using the Modeler Edition, the Meta Compiler is automatically started by the Visual Studio Integrated Environment through the standard Build command.

Note: For builds above 659, a new CodeFluent.Build4.exe is shipped aside CodeFluent.Build.exe. This executable is built on the CLR 4 (when CodeFluent.Build.exe is built on the CLR 2) and allows easier integration for custom assemblies (such as custom Aspects or Producers) created for the CLR 4. CodeFluent.Build.exe can be used with CLR 4 assemblies but it requires .config modifications. For the Modeler Edition, CodeFluent.Build4.exe is also shipped in the x64 folder as a native 64-bit application.

This command line tool accepts the following options:

Option Description
/DoNotProduce Only loads the model
/DisableImports Disable imports
/AutoDisableImports Automatically disable failing imports
/ExtractSchema Extracts CodeFluent.xsd to the current directory
/ExtractSchemaVS8 Extracts CodeFluent.xsd to Visual Studio 2005 Xml schema directory
/ExtractSchemaVS9 Extracts CodeFluent.xsd to Visual Studio 2008 Xml schema directory
/ExtractSchemaVS10 Extracts CodeFluent.xsd to Visual Studio 2010 Xml schema directory
/ExtractSchemaVS12 Extracts CodeFluent.xsd to Visual Studio 2012 Xml schema directory
/ExtractDefaultApplication Extracts DefaultApplication.xml to the current directory
/DeleteCache Delete default templates cache
/NoFlashOnError Do not flash console on error
/Reports Shows the reporting dialog box
/Continuous Does not exit when production is finished
/RunTemplate:<Source>,<Target> Runs the template engine from the source directory path to the target path

Example

This example demonstrates how to use the meta compiler tool to generate layers from the Sample.xml model.

Below is the content of a Generate.bat batch file which launches CodeFluent.Build.exe.

Generate.bat Copy Code
call "%ProgramFiles%\SoftFluent\CodeFluent\Current\CodeFluent.Build.exe" Sample.xml

Below is the content of the Sample.xml model which defines a Customer entity, and the Microsoft SQL Server Producer as well as the Business Object Model Producer.

Model Copy Code
<!-- Sample.xml -->
<cf:project xmlns:cf="http://www.softfluent.com/codefluent/2005/1"
            defaultNamespace="Sample"
            defaultKeyPropertyTypeName="int"
            defaultConnectionString="server=(local)\SQLEXPRESS;database={1};Integrated Security=true">
    <!-- Microsoft SQL Server Producer -->
    <cf:producer typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
        <configuration targetDirectory="..\Generated\Sql" />
    </cf:producer>
    <!-- Business Object Model Producer -->
    <cf:producer typeName="CodeFluent.Producers.CodeDom.CodeDomProducer, CodeFluent.Producers.CodeDom">
        <configuration targetDirectory="..\Generated\Model" outputName="{0}.dll" />
    </cf:producer>
    <!-- Entities -->
    <Customer>
        <Id typeName="int" />
        <FirstName typeName="string" />
        <LastName typeName="string" />
    </Customer>
</cf:project>

See Also