RdJNL / TextTemplatingCore

T4 Text Templating with .NET 6
Other
57 stars 15 forks source link

Can't wok on System.Xml.Linq ... #8

Closed fxing closed 2 years ago

fxing commented 3 years ago

<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ assembly name="System.Xml.XDocument" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Xml.Linq" #> <#@ output extension=".txt" #> <#
string output; output = new XElement("Test").ToString();

>

<#= output #>

Got error "error CS1069: The type name 'XElement' could not be found in the namespace 'System.Xml.Linq'. This type has been forwarded to assembly 'System.Private.Xml.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly."

RdJNL commented 2 years ago

I'm sorry for the late reply, but the fix is in the error message :)

Add the following assembly directive: <#@ assembly name="System.Private.Xml.Linq" #>