This documentation is archived and is not being maintained.

GenerateTemporaryTargetAssembly Task

The GenerateTemporaryTargetAssembly task generates an assembly if at least one Extensible Application Markup Language (XAML) page in a project references a type that is declared locally in that project. The generated assembly is removed after the build process is completed, or if the build process fails.




Required String parameter.

Specifies the short name of the assembly that is generated for a project and is also the name of the target assembly that is temporarily generated. For example, if a project generates a Windows executable whose name is WinExeAssembly.exe, the AssemblyName parameter has a value of WinExeAssembly.


Required String parameter.

Specifies the name of the Microsoft build engine (MSBuild) target that is used to generate assemblies from source code files. The typical value for CompileTargetName is CoreCompile.


Required String parameter.

Specifies the type of compilation that is performed by the target that is specified by the CompileTargetName parameter. For the CoreCompile target, this value is Compile.


Required String parameter.

Specifies the full path of the MSBuild project file for the project that requires a temporary target assembly.


Optional ITaskItem[] parameter.

Specifies the list of language-specific managed code files that were generated by the MarkupCompilePass1 Task task.


Required String parameter.

Specifies the directory that the temporary target assembly is generated to.


Required String parameter.

Specifies the location of MSBuild.exe, which is required to compile the temporary target assembly.


Optional ITaskItem[] parameter.

Specifies a list of assemblies, by path and file name, that are referenced by the types that are compiled into the temporary target assembly.


Required String parameter.

Specifies the parameter that is used by the compilation target (CompileTargetName) parameter that specifies the list of assembly references (ReferencePath). The appropriate value is ReferencePath.

The first markup compilation pass, which is run by the MarkupCompilePass1 Task, compiles XAML files to binary format. Consequently, the compiler needs a list of the referenced assemblies that contain the types that are used by the XAML files. However, if a XAML file uses a type that is defined in the same project, a corresponding assembly for that project is not created until the project is built. Therefore, an assembly reference cannot be provided during the first markup compilation pass.

Instead, MarkupCompilePass1 defers the conversion of XAML files that contain references to types in the same project to a second markup compilation pass, which is executed by the MarkupCompilePass2 Task. Before MarkupCompilePass2 is executed, a temporary assembly is generated. This assembly contains the types that are used by the XAML files whose markup compilation pass was deferred. A reference to the generated assembly is provided to MarkupCompilePass2 when it runs to allow the deferred compilation XAML files to be converted to binary format.

The following example generates a temporary assembly because Page1.xaml contains a reference to a type that is in the same project.

<Project xmlns="">
    AssemblyFile="C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationBuildTasks.dll" />
  <Target Name="GenerateTemporaryTargetAssemblyTask">
      ReferencePath="c:\windows\\Framework\v2.0.50727\System.dll;C:\Program Files\Reference Assemblies\Microsoft\WinFx\v3.0\PresentationCore.dll;C:\Program Files\Reference Assemblies\Microsoft\WinFx\v3.0\PresentationFramework.dll;C:\Program Files\Reference Assemblies\Microsoft\WinFx\v3.0\WindowsBase.dll"