GenerateTemporaryTargetAssembly Task


For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see GenerateTemporaryTargetAssembly Task on 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.

AssemblyNameRequired 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.
CompileTargetNameRequired 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.
CompileTypeNameRequired 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.
CurrentProjectRequired String parameter.

Specifies the full path of the MSBuild project file for the project that requires a temporary target assembly.
GeneratedCodeFilesOptional ITaskItem[] parameter.

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

Specifies the directory that the temporary target assembly is generated to.
MSBuildBinPathRequired String parameter.

Specifies the location of MSBuild.exe, which is required to compile the temporary target assembly.
ReferencePathOptional 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.
ReferencePathTypeNameRequired 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, 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. 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"  

WPF MSBuild Reference
Task Reference
MSBuild Reference
Task Reference
Building a WPF Application (WPF)
WPF XAML Browser Applications Overview