SharePoint 2010: feature receiver code executed from UI, not from PowerShell or stdadm -
i have wsp containing web scope feature following code:
using system; using system.runtime.interopservices; using system.security.permissions; using microsoft.sharepoint; using microsoft.sharepoint.security; namespace macaw.duallayout.samples.features.duallayoutsampleempty_web { [guid("8b558382-5566-43a4-85fa-ca86845b04b0")] public class duallayoutsampleempty_webeventreceiver : spfeaturereceiver { public override void featureactivated(spfeaturereceiverproperties properties) { using (spweb web = (spweb)properties.feature.parent) { using (spsite site = (spsite)web.site) { uri uri = new uri(site.url + "/_catalogs/masterpage/dlsampleempty.master"); web.custommasterurl = uri.absolutepath; // master publishing pages web.update(); } } } public override void featuredeactivating(spfeaturereceiverproperties properties) { using (spweb web = (spweb)properties.feature.parent) { using (spsite site = (spsite)web.site) { uri uri = new uri(site.url + "/_catalogs/masterpage/v4.master"); web.custommasterurl = uri.absolutepath; // master publishing pages web.update(); } } } } }
i f5 deployment visual studio 2010. when activate feature ui breakpoint in feature code, feature code executed. when activate feature powershell:
enable-spfeature -url http://myserver/sites/publishing/empty -identity myfeaturename -force -verbose
or stsadm:
stsadm -o activatefeature -name myfeaturename -url http://myserver/sites/publishing/empty -force
i see feature activated (in ui), don't hit breakpoint , feature receiver code not executed.
any ideas?
if use powershell or stsadm feature not run in context of iis worker process. attach vs studio when debug?
when debugging stsadm tasks add:
system.diagnostics.debugger.launch();
to code , prompted attach debugger when command run. crude easy. (don't forget remove)
Comments
Post a Comment