I recently updated my umbraco site from version 4.9 to version 7.0.1 I had some code for the site that provided various database interaction methods, written in C# and it is compiled and copied into my /bin folder as My-Project.dll
Since version 7.01 of umbraco uses .NET 4.5, I had to upgrade my visual studio 2010 to 2013 to be able to compile my .NET 4.5 code that references umbraco.dll .
This throws an exception : Cannot find a script or an extension object associated with namespace 'urn:My_Project'
I have the following definition in my xslt file: xmlns:My_Project="urn:My-ProdList"
And I have also declared it in my /config/xsltExtensions.config as <ext assembly="My-Project" type="My_Project.ProductList" alias="My-ProdList" />
Where My_Project.ProductList is a class that's a part of My-Project.dll that has a method called GetProductCountXML() that takes 4 parameters.
The setup I described above used to work before I updated umbraco to version 7.0.1 and .NET target version of my project from 4.0 to 4.5 (so it could work with umbraco.dll of version 7)
I think you just need to add an [XsltExtension] attribute to your C# class/module/... but I should in no way be allowed to answer that, since I'd only open Visual Studio when threatened with fire or Hello Kitties :-)
I'm sure someone will chip in with the answer you're looking for; I'll poke the Twittersphere...
Chriztian is right, just have to include the name of the extention I am calling in the attribute like [XsltExtension("My-ProdList")] just before my class declaration.
How to include xslt extension in umbraco 7 ?
Hello everyone
I recently updated my umbraco site from version 4.9 to version 7.0.1
I had some code for the site that provided various database interaction methods, written in C# and it is compiled and copied into my /bin folder as My-Project.dll
Since version 7.01 of umbraco uses .NET 4.5, I had to upgrade my visual studio 2010 to 2013 to be able to compile my .NET 4.5 code that references umbraco.dll .
I had some calls to my code in xslt defined as
<xsl:variable name="pagingData" select="My_Project:GetProductCountXML($n1, $n2, $n3, $n4)/descendant-or-self::pageing" />
This throws an exception : Cannot find a script or an extension object associated with namespace 'urn:My_Project'
I have the following definition in my xslt file:
xmlns:My_Project="urn:My-ProdList"
And I have also declared it in my /config/xsltExtensions.config as
<ext assembly="My-Project" type="My_Project.ProductList" alias="My-ProdList" />
Where My_Project.ProductList is a class that's a part of My-Project.dll that has a method called GetProductCountXML() that takes 4 parameters.
The setup I described above used to work before I updated umbraco to version 7.0.1 and .NET target version of my project from 4.0 to 4.5 (so it could work with umbraco.dll of version 7)
EDIT : Recreated my topic in xslt section , admins please delete old one :
http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/47355-Problem-running-C-assembly-after-umbraco-7-and-NET-update
EDIT: I see that /config/xsltExtensions.config has been removed, but I haven't found a way to include the extentions in umbraco 7
http://our.umbraco.org/forum/developers/xslt/46533-no-more-xsltExtensionsconfig-in-Umb-7
Hi René - I've deleted the old topic as requested (was just about to move it here :-)
I think you just need to add an
[XsltExtension]
attribute to your C# class/module/... but I should in no way be allowed to answer that, since I'd only open Visual Studio when threatened with fire or Hello Kitties :-)I'm sure someone will chip in with the answer you're looking for; I'll poke the Twittersphere...
/Chriztian
Comment author was deleted
Yeah :) http://www.nibble.be/?p=95
Chriztian is right, just have to include the name of the extention I am calling in the attribute like [XsltExtension("My-ProdList")] just before my class declaration.
Lee linked a good example that solves the problem here :
http://our.umbraco.org/forum/developers/xslt/46533-no-more-xsltExtensionsconfig-in-Umb-7?p=0#comment169442
Thanks to everyone for the quick replies!
is working on a reply...