SharePointCommunity
Die deutschsprachige Community für SharePoint, Microsoft 365, Teams, Yammer und mit Azure
Renaming a SharePoint Solution

Blogs

Oliver Wirkus

Syndication

Certifications

Web 2.0

http://smits-net.de/img/linkedin_button.gif

XING

http://i80.photobucket.com/albums/j191/mikesamerica/twitter_button_zpsee74f711.png

 

 Add to Technorati Favorites

 

 Delicious Bookmark this on Delicious

 

  Locations of visitors to this page

 

Recently I was facing the challenge to rename a SharePoint Solution. I needed to rename the contained projects and even the namespaces. If you ever did that, you might know that this is everything but easy.

It took a long time until I finished the renaming. Visual Studio was able to compile the whole solution without any errors and I was able to deploy the solution to SharePoint. At first I was astonished, but this was too good to be true.

After I had deployed the renamed solution, I tried to place one of the web parts to a page … and got an error: the type is not registered as safe.

clip_image001

I thought ‘No big deal’ and had a look into the file web.config and located the <SafeControls> section. I found the line which is used to register the web part – and noticed, that the namespace has been wrong. Looked like I neglected to change a namespace during the renaming process.

Back to Visual Studio and my solution. I switched the Solution Explorer to ‘Show all files’, located the .webpart file and opened it. I only found a property for the name of the type and it had been set to the correct value. I did not find any namespace setting here.

Next step: I checked the packaging. I opened the Package Designer in Visual Studio and clicked on the ‘Manifest’ button at the bottom of the page to have a look on the xml data. Here I found the complete <SafeControl> setting and to no surprise the namespace had been wrong.

I changed the xml data manually and corrected the namespace setting. After another deployment I was able to add the web part to a page without any error. That was expected and now I was sure that the problem had been the wrong namespace setting in the Solution Package. But I didn’t want to manually change the package xml so I discarded the changes and re-enabled the Package Designer – and all of a sudden the namespace got the wrong setting again.

To solve this problem I needed to find out how the Package Designer is retrieving the namespace setting. So I had a look into another ‘hidden’ file used by Visual Studio. This one is called SharePointProjectItem.spdata. I opened it and again I found a complete <SafeControl> setting – and the namespace again had the wrong value. I corrected the namespace and saved the file. After I opened the Package Designer again, the namespace in the xml data of the Package had the correct value. Not surprisingly the deployment now went well again!

Two lessons learned: renaming a SharePoint solution with contained projects can be very tricky (I’ve already known that) and in case of any weird problems have a look on hidden project files (like *.wepart and SharePointProjectItem.spdata).

TweetButton


Bereitgestellt 19 Nov 2014 9:23 von Oliver Wirkus