Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1100323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:51:44+00:00 2026-05-17T00:51:44+00:00

I have a WSP containing a web scope feature with the following code: using

  • 0

I have a WSP containing a web scope feature with the 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 for all 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 for all publishing pages
                    web.Update();
                }
            }
        }
    }
}

I do F5 deployment from Visual Studio 2010.
When I activate the feature from UI I get into my breakpoint in the feature code, the feature code is executed.
When I activate the feature from PowerShell:

Enable-SPFeature -Url http://myserver/sites/publishing/empty -Identity MyFeatureName -force -verbose

or with STSADM:

stsadm -o activatefeature -name MyFeatureName -url http://myserver/sites/Publishing/Empty -force

I see that the feature is activated (in the UI), but I don’t hit my breakpoint and the feature receiver code is NOT executed.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:51:45+00:00Added an answer on May 17, 2026 at 12:51 am

    If you use powershell or stsadm the feature will not run in the context of the IIS worker process. What do you attach VS studio to when you debug?

    When debugging stsadm tasks I usually add:

    System.Diagnostics.Debugger.Launch();

    to the code and you will be prompted to attach a debugger when the command is run. Crude but easy. (Don’t forget to remove)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feature that gets installed using a WSP package, when the feature
I have created a web part using VSeWSS 1.3. It creates a wsp file
I have created a feature in Visual Studio, using WSPBuilder to build the .wsp
I have been using WSP builder up until now with VS 2008. I recently
I have tried creating several web parts using Visual Studio 2010 using available guides
I have a custom (code-based) workflow, deployed in WSS via features in a .wsp
I am converting code from a Website Project (WSP) to a Web Application Project.
Have a look at the following code. The goal here is to return a
I am trying to recompile some code I have for a new system. It
I have a site which has a number (20 or so) web parts. Each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.