Поделиться через


Task 1: Create the Workflow Hosting Project File

The project file that is created in this step can be modified to handle most Microsoft Windows samples that are written completely in procedural code. If you are writing the application in C#, you typically give the project a .csproj file name extension. If you are writing it in Visual Basic, give the file a .vbproj extension.

You use this project in the rest of the tutorial. As you progress through the tutorial, you edit this file to add new project files.

Procedures

To create the HostingWorkflows project file

  1. In your project directory, create a new file named Hosting.

  2. Give it a .csproj extension if you are creating a C# project or a .vbproj extension if it is a Visual Basic project.

  3. Copy and paste the following text into the project file that you created in the previous step.

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
        <ProductVersion>8.0.50727</ProductVersion>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{8218D09F-CB99-4CCA-BA4D-857873D68DC8}</ProjectGuid>
        <ProjectTypeGuids>{D59BE175-2ED0-4C54-BE3D-CDAA9F3214C8};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
        <OutputType>Exe</OutputType>
        <StartupObject>
        </StartupObject>
        <RootNamespace>Hosting</RootNamespace>
        <AssemblyName>Hosting</AssemblyName>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <DefineDebug>true</DefineDebug>
        <DefineTrace>true</DefineTrace>
        <IncrementalBuild>true</IncrementalBuild>
        <OutputPath>bin\</OutputPath>
        <DefineConstants>_MyType="Windows"</DefineConstants>
        <DocumentationFile>Hosting.xml</DocumentationFile>
        <UseVSHostingProcess>false</UseVSHostingProcess>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
        <DebugSymbols>false</DebugSymbols>
        <DefineDebug>false</DefineDebug>
        <DefineTrace>true</DefineTrace>
        <IncrementalBuild>false</IncrementalBuild>
        <Optimize>true</Optimize>
        <OutputPath>bin\</OutputPath>
        <DefineConstants>_MyType="Windows"</DefineConstants>
        <DocumentationFile>Hosting.xml</DocumentationFile>
        <UseVSHostingProcess>false</UseVSHostingProcess>
      </PropertyGroup>
      <ItemGroup>
        <Reference Include="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <Name>System</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <Name>System.Data</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <Name>System.Transactions</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <Name>System.Xml</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
          <Name>System.Workflow.Activities</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
          <Name>System.Workflow.ComponentModel</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
          <Name>System.Workflow.Runtime</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
          <Name>System.Design</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
          <Name>System.Drawing</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
          <Name>System.Drawing.Design</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Windows.Forms">
          <Name>System.Windows.Forms</Name>
        </Reference>
        <Reference Include="mscorlib">
          <Name>mscorlib</Name>
        </Reference>
        <Reference Include="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
          <Name>System.Web</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
        <Reference Include="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
          <Name>System.Web.Services</Name>
          <SpecificVersion>True</SpecificVersion>
        </Reference>
      </ItemGroup>
      <ItemGroup>
        <Import Include="Microsoft.VisualBasic" />
        <Import Include="System" />
        <Import Include="System.Collections" />
        <Import Include="System.Data" />
        <Import Include="System.Diagnostics" />
        <Import Include="System.ComponentModel" />
        <Import Include="System.ComponentModel.Design" />
        <Import Include="System.Drawing" />
        <Import Include="System.Workflow.ComponentModel.Compiler" />
        <Import Include="System.Workflow.ComponentModel.Serialization" />
        <Import Include="System.Workflow.ComponentModel" />
        <Import Include="System.Workflow.ComponentModel.Design" />
        <Import Include="System.Workflow.Runtime" />
        <Import Include="System.Workflow.Activities" />
        <Import Include="System.Workflow.Activities.Rules" />
        <Import Include="System.Collections.Generic" />
        <Import Include="System.Text" />
        <Import Include="System.Threading" />
        <Import Include="System.Workflow.Runtime" />
        <Import Include="System.Workflow.Runtime.Hosting" />
      </ItemGroup>
      <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.Targets" />
      <Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.VisualBasic.Targets" />
      <PropertyGroup>
        <PreBuildEvent>
        </PreBuildEvent>
        <PostBuildEvent>
        </PostBuildEvent>
      </PropertyGroup>
    </Project>
    
    <Project DefaultTargets="Build" xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <ProductVersion>8.0.50727</ProductVersion>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{5A64A015-7D04-4FE2-9C7E-8F54B3622853}</ProjectGuid>
        <OutputType>Exe</OutputType>
        <RootNamespace>Microsoft.Samples.Workflow.Tutorials.Hosting</RootNamespace>
        <AssemblyName>Hosting</AssemblyName>
        <ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <Optimize>false</Optimize>
        <OutputPath>.\bin\Debug\</OutputPath>
        <DefineConstants>DEBUG;TRACE</DefineConstants>
        <UseVSHostingProcess>false</UseVSHostingProcess>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
        <DebugSymbols>false</DebugSymbols>
        <Optimize>true</Optimize>
        <OutputPath>.\bin\Release\</OutputPath>
        <DefineConstants>TRACE</DefineConstants>
        <UseVSHostingProcess>false</UseVSHostingProcess>
      </PropertyGroup>
      <ItemGroup>
        <Reference Include="System.Workflow.Activities" />
        <Reference Include="System.Workflow.ComponentModel" />
        <Reference Include="System.Workflow.Runtime" />
        <Reference Include="System" />
        <Reference Include="System.Data" />
        <Reference Include="System.Design" />
        <Reference Include="System.Drawing" />
        <Reference Include="System.Drawing.Design" />
        <Reference Include="System.Transactions" />
        <Reference Include="System.Xml" />
        <Reference Include="System.Web" />
        <Reference Include="System.Web.Services" />
        <Reference Include="System.Configuration" />
      </ItemGroup>
      <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
      <Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />
    </Project>
    

Compiling the Code

For information about compiling your code, see Compiling the Code.

In Task 2: Create a Sequential Workflow, you create a basic sequential workflow that you use for the rest of the tutorial.

See Also

Concepts

Workflow Authoring Styles

Other Resources

Task 2: Create a Sequential Workflow
Developing Workflow-Enabled Applications