Bonjour,

J'essaye de retrouver l'erreur dans ce fichier :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".names" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="System.Xml.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Xml.Linq" #>
 
 
<root>
<#
 
 
			try
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
				string myFile = "MyFile.txt";
                using (StreamReader sr = new StreamReader(mFile))
                {
                    string line;
                    Dictionary<int, string> RechercheDoublons = new Dictionary<int, string>();
                    int counter1 = 0;
                    while ((line = sr.ReadLine()) != null)
                    {
                        string[] divide = line.Split(Convert.ToChar(" "));
                        if (divide.Length > 0)
                        {
                            foreach (string str in divide)
                            {
                                string str1 = str.Trim();
                                if (!RechercheDoublons.ContainsValue(str1))
                                    RechercheDoublons.Add(counter1, str1);
                                counter1++;
                            }
                        }
                        else
                        {
                            if (!RechercheDoublons.ContainsValue(line.Trim()))
                                RechercheDoublons.Add(counter1, line.Trim());
                            counter1++;
                        }
                    }
 
                    foreach (KeyValuePair<int, string> kvp in RechercheDoublons)
                    {
						string MyParse = kvp.Key.ToString();
						string MyParse2 = kvp.Value; #> 
						<name id="<# MyParse #>"><# MyParse2; #></name><#
 
                    }
                }
            }
            catch (Exception ex)
            {
                // Let the user know what went wrong.
                write("error" + ex.Message);
            }
#>
</root>
Il s'agit d'un TexteTemplate, (T4) et l'erreur est (bien planquée):

Erreur 3 Compilation de la transformation*: ; attendu c:\Users\Ukyuu\Documents\Visual Studio 2010\Projects\RandomGenerators\Random Name Generator\ListOfName.tt 53 9