") Expected" using t4 text templates in c#

549 Views Asked by At

Trying to make a conversion .exe between a .gbxml filetype and a .idf filetype by using a t4 text template, i ran into an error.

Somehow, this code snippet keeps telling me: Error CS1026: ) expected. This occurs after the 'relative north{deg}");' part I tried putting in more brackets, just to see what happens, but the error keeps occurring.

Here's the part of the text template:

<# foreach(XElement zone in doc.Element(ns+"Campus").Element(ns+"Building").Elements(ns+"Space")
{
WriteLine("Zone,");
WriteLine("    "+ zone.Element(ns+"Name").Value + ",   !- Name");
WriteLine("    0.00000,"+ "!- Direction of Relative North {deg}");
WriteLine("    0.0,                     !- X Origin {m}");
WriteLine("    0.0,                     !- Y Origin {m}");
WriteLine("    0.0,                     !- Z Origin {m}");
WriteLine("    1,                       !- Type");
WriteLine("    1.0,                     !- Multiplier");
WriteLine("    autocalculate,           !- Ceiling Height {m}");
WriteLine("    "+zone.Element(ns+"Volume").Value + ",                !- Volume {m3}");
WriteLine("    "+zone.Element(ns+"Area").Value + ";                !- Floor Area {m2}");
}#>

Has anyone had experience with this problem? Thanks in advance.

EDIT: Resolved. I forgot the ) at the end of the foreach loop. Thank you for your help.

1

There are 1 best solutions below

0
On

You are opening a parenthesis in

foreach(

that you never close.

foreach(XElement zone in doc.Element(ns+"Campus").Element(ns+"Building").Elements(ns+"Space")  )