0

I'm currently working on a C# solution that was abandonned years ago by somone i have no contact with. It uses a Wix to generate the msi and contain a whole project named "TemplatingWixSetup" that include T4 templates. Note that i'm note experienced with Wix setting. Part of them contains methods but those were not included in any class definition. This was not compiling so i included all the methodes in a class named after the .tt file name for each templates. Here the WixDirectoryTree.tt contains the methods needed so i included all the methods it contained in the class named WixDirectoryTree.

I then get few errors for one of the templates. It only uses one of the methods to check the existance of a directory and create it if needed.

<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".wxs" #>
<#@ assembly name="System.Core.dll" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Security.Cryptography" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ include file="WixDirectoryTree.tt" #>
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<#
  TryAndGenerateDirectory(@"..\MatterSlice", "OpenSourceMatterSlice", "$(var.SolutionDir)MatterSlice", "ProgramFilesOpenSourceMatterSlice");
  TryAndGenerateDirectory(@"..\t4", "OpenSourceMonoT4", "$(var.SolutionDir)t4", "ProgramFilesOpenSourcet4");
#>
</Wix>

I maneged to correct part of them by creating a instance of the class i included in WixDirectoryTree but one error remains. See the folowing code which is the whole concerned file:

<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".wxs" #>
<#@ assembly name="System.Core.dll" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Security.Cryptography" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ include file="WixDirectoryTree.tt" #>
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<#  var wixDirectoryTree = new WixDirectoryTree();
    wixDirectoryTree.TryAndGenerateDirectory(@"..\MatterSlice", "OpenSourceMatterSlice", "$(var.SolutionDir)MatterSlice", "ProgramFilesOpenSourceMatterSlice");
    wixDirectoryTree.TryAndGenerateDirectory(@"..\t4", "OpenSourceMonoT4", "$(var.SolutionDir)t4", "ProgramFilesOpenSourcet4");
#></Wix>

There is the error:

Erreur CS1022 Compiling transformation: Type or namespace definition, or end-of-file expected TemplatingWixSetup C:\Users\Admin\Documents\cola\TemplatingWixSetup\OpenSource.tt 350 Actif

I honestly don't know what to do, or what could cause the problem. I made sure that the tag '' is not followed by anything. I wonder if it has anything to do with the fact that i introduced the class befor but that also implies compliling errors.

Shynord
  • 1
  • 1
  • What did the original xml file look like? What you posted is not valid xml. – jdweng Jun 19 '23 at 12:37
  • @jdweng just added the original file. As i said it's one amoung many T4 templates used in the Wix Setup project. I have no experience on how to use them and struggle to found tuto that explain the use of .tt files in this context. I guess that the whole point is to generate the .wxs files that would be the base for msi. – Shynord Jun 19 '23 at 13:42
  • See if this helps : https://stackoverflow.com/questions/48424953/how-to-define-a-directory-structure-path-to-use-as-the-workingdirectory-attrib – jdweng Jun 19 '23 at 14:21

0 Answers0