I have created the SharePoint project and added the ".master" file and related CSS and js files. then created the WSP file by publishing the project.after that, I have created the PowerShell script to deploy that WSP file into SharePoint site. I need to change the attribute of the .master file using PowerShell script .is possible to do this?

Suggest an idea to change the "href" value of the particular div in ".master" file which is in the WSP file.

  • Try open site in SharePoint designer, then open master page and change the URL for your anchor tag Commented Dec 8, 2016 at 5:14
  • Do you mean the "href" attribute of an anchor? And most importantly, do you want to change the master page file within the WSP after it has been published. You don't want to make change and republish it? Am I getting it right, this time?
    – Aks
    Commented Dec 8, 2016 at 11:06

1 Answer 1


Correct me if I'm wrong, you need this for replacing the site URL after deployment of WSP.

Since you are creating the WSP, may I suggest the event receiver approach?

Here's how you can go about it, first you put a string placeholder where you need the href value replaced. Next you write add an event receiver to your feature and write the logic to replace the string placeholder with the desired value after the feature is activated in FeatureActivated method.

Hope this helps.

Basically you can do the same thing with PowerShell using CSOM if you don't like the event receiver.

I gave you much simple option than the PowerShell one. Choice is yours.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.