I'm having problems getting a user control working.
here's what I'm doing:
I'm creating a web application in VS 2008, in the web app I'm adding a web user control. I build the project and then copy the dll to umbraco bin folder, the ascx and the ascx.vb to the usercontrols folder in umbraco.
when view my site I see:
Error creating control (usercontrols/SRContactForm.ascx). Maybe file doesn't exists or the usercontrol has a cache directive, which is not allowed! See the tracestack for more information!
Stack Trace shows:
Error creating usercontrol (usercontrols/SRContactForm.ascx) InternalXmlHelper.vb(9): error BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'. at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at umbraco.macro.loadUserControl(String fileName, Hashtable attributes, Hashtable pageElements)
The error is because the .Net compiler can't detect the type of ExtensionAttribute in your InternalXmlHelper class. If you specify the type including the namsepaces it should work.
I believe I'm using the UMB 4.5.1. I installed this version manually about a month ago. web.config has references to version 4. So I think I'm using version 4 as the app pool is set to .net 4 integrated.
the problem arises when i add a user control created in VS 2008. I get the error I listed above.
And are you targeting .NET 4 in VS 2008? I'm guessing not as you mentioned it worked when you switched to .NET 2 in your app pool.
The problem is your dll's are working with different versions of .NET, so you've got conflicts. I'd say you wither need to target .NET 4 in your VS project (I'm not sure if that's possible in VS 2008) or try using the .NET 3.5 build of Umbraco.
Correct, not painfull at all. Copy over bin, umbraco, umbraco_client, install directories. Make sure take filesystem and db backup first. 4.5.2 is a lot better than 4.5.1 so this should be done anyway.
Unlike said on codeplex it is not fixed, i updated my umbraco installation to 4.5.2 and i still get this error, is there a special trick to do after this ?
I was trying to add a contact form ctl to a site up and running, in the end even after an upgrade it didn't work. so i didn't go ahead with it,
but just to satisfy my selfy i created a website on my local host. i downloaded umbraco 4.5.2 using web platform installer 3 (beta) to get the .net 4 version.
when i added the user control (which simply out put "Hello World") it seemed to render the message correctly.
.net user control in umbraco version 4.5
Hi everyone,
I'm having problems getting a user control working.
here's what I'm doing:
I'm creating a web application in VS 2008, in the web app I'm adding a web user control. I build the project and then copy the dll to umbraco bin folder, the ascx and the ascx.vb to the usercontrols folder in umbraco.
when view my site I see:
Error creating control (usercontrols/SRContactForm.ascx).
Maybe file doesn't exists or the usercontrol has a cache directive, which is not allowed! See the tracestack for more information!
Stack Trace shows:
Error creating usercontrol (usercontrols/SRContactForm.ascx)
InternalXmlHelper.vb(9): error BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'.
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
at umbraco.macro.loadUserControl(String fileName, Hashtable attributes, Hashtable pageElements)
Hi,
The error is because the .Net compiler can't detect the type of ExtensionAttribute in your InternalXmlHelper class. If you specify the type including the namsepaces it should work.
Cheers,
Richard
Hi Richard thanks for your reply,
I haven't added ExtensionAttribute in the InternalXmlHelper class. I get this error version umb 4.5.1.
I get same error in umb 4.5.2 until i change app pool to .net 2 integrated.
Hi Sajid,
What version of .NET are you compiling your web application against? And what compiled version of Umbraco 4.5.x are you using? (.NET 3.5 or .NET 4.0)
You may have an issue with using extension methods compiled in different version of .NET
Have a look at this article for details.
http://www.thesoftwaredevotional.com/2009/01/warning-about-using-extension-methods.html
Matt
Hi Matt, thanks for yr reply.
I believe I'm using the UMB 4.5.1. I installed this version manually about a month ago. web.config has references to version 4. So I think I'm using version 4 as the app pool is set to .net 4 integrated.
the problem arises when i add a user control created in VS 2008. I get the error I listed above.
And are you targeting .NET 4 in VS 2008? I'm guessing not as you mentioned it worked when you switched to .NET 2 in your app pool.
The problem is your dll's are working with different versions of .NET, so you've got conflicts. I'd say you wither need to target .NET 4 in your VS project (I'm not sure if that's possible in VS 2008) or try using the .NET 3.5 build of Umbraco.
Matt
Hi Matt,
I was creating a user control vs2008 and uploading the ascx and the dll to umb 4.5.1. this gave the error.
(i manually uploaded umb 4.5.1 to my host .net 4 version)
I just created the same usercontrol in vs2010 and uploaded to 4.5.1, same error
I created the usercontrol as a web app and copied the dll to umb bin folder and the ascx to umb user controls folder.
I am missing something or doing something incorrectly?
Wasn't there some kind of problem with creating VB.net user controls in 4.5.1??? Will try and find linky...
skiltz,
ahhh i hope thats the case as I'm pulling my hair out trying to get it working.
awaiting yr reply.
http://umbraco.codeplex.com/workitem/28307
So in essence I cannot add the user control to umb 4.5.1? Is that right?
If I wanted to upgrade 4.5.1 to 4.5.2 is that a painful thing to do?
Correct, not painfull at all. Copy over bin, umbraco, umbraco_client, install directories. Make sure take filesystem and db backup first. 4.5.2 is a lot better than 4.5.1 so this should be done anyway.
Skiltz, Thankyou.
So what I will do is get the web platform installer 3 and download umbraco 4.5.2 .net 4 version on my local host.
and ftp the directories you mention above to my web site, is this right?
Just to confirm the directories that need to be replaced:
bin
install
umbraco
umbraco_client
There is a guide here http://our.umbraco.org/wiki/install-and-setup/upgrading-an-umbraco-installation -
Wow, lets hop I can do it Correctly
ok will do it and let you know if succeed.
so in total i need to replace the following folders / files:
Hi I downloaded the latest umb 4.5.2 from codeplex.
and copied over to my website the files/folders mentioned above.
when i run the umbracoinstaller, it ran successfully but indicated my db was uptodate, is that correct?
anyway..same error with user control appears.
any ideas?
thanks in advance
The upgrade didn't worked fine. But the user control was still giving error.
So ended up downloading the 4.5.2 and re-doing the website. all is ok now.
Sajid
I have the exactly same problem since umb 4.01.
This issue has already been reported : http://our.umbraco.org/forum/using/ui-questions/11217-ExtensionAttribute-is-ambiguous-Why-is-it-not-getting-attention?p=0#comment46136
Unlike said on codeplex it is not fixed, i updated my umbraco installation to 4.5.2 and i still get this error, is there a special trick to do after this ?
Hey Thomas,
I was trying to add a contact form ctl to a site up and running, in the end even after an upgrade it didn't work. so i didn't go ahead with it,
but just to satisfy my selfy i created a website on my local host. i downloaded umbraco 4.5.2 using web platform installer 3 (beta) to get the .net 4 version.
when i added the user control (which simply out put "Hello World") it seemed to render the message correctly.
but thats all i did.
is working on a reply...