Showing posts with label install. Show all posts
Showing posts with label install. Show all posts

Tuesday, August 3, 2010

Assembly redirection in WSP

Recently I have started upgrading our utilities to the new SharePoint 2010 version,

One of my main goals there was to get rid of the MSI installer we had to use on our products for SharePoint 2007, and go with a "cleaner" installation process of using the SharePoint WSP package alone.

One of the challenges was that as an ISV we have no control over our customer's server, setup or versions installed. Which means, any customer may have any mix of products and versions at the same time.

For example: say we have 2 products - ProductA and ProductB (both at version 1.0.0.00) that were build using our shared utilities DLL: utilities.dll version 1.0.0.01

A month later, we add a new feature in our utilities.dll that is used on ProductB, so now we have upgraded our utilities to version 1.0.0.02 and our ProductB to version 2.0.0.00 and we publish that to the Internet.

Now our customer upgrades his copy of ProductB only.
We had 2 options here:
1. keep both utilities version
2. upgrade and keep only version 1.0.0.02

The first option was no good, since for example our utilities declare a feature called FeatureA. if 2 different packages declare that same feature, and one of them is retracted later on - the feature will be uninstalled with it (There are some other issues like this one, but this is not the scope of this article).

So, sticking with the second option was pretty simple: just install the latest version of utilities with no other older versions of it anywhere.
The only issue was, How will it "tell" all other older products (ProductA) to start using utilities.dll version 1.0.0.02?!

I have looked everywhere for a solution that was just under my nose.

Apparently in VS2010 and SharePoint 2010 there is a new XML node in the package XML definition, right next to the assembly "SafeControls" node.

This new XML node is called "BindingRedirect", and it allows you to specify in the solution package itself any Assembly version redirection you might need!

Problem is - the package designer does not expose this property, so you have to enter it in the Package.Template.Xml directly.

here is how my package.template.xml file looks like:

The end result is:

And this simple produces the following entree in the web.config:

Now, as far as I tested:
  1. Retracting solution cleans this entree up with no problem!
  2. Deploying a new version upgrades this entree and does not create duplicate entrees!
  3. It is safe (like in my example) to give a wide version range in the oldVersion property - even for future versions that do not exist yet. it will simply allow you not to update this every time you build a new version.
So far, this solution had worked out perfect for me, and it is by far the easiest and most simple way to do it in SharePoint than any other way I found on the web - so hope this helps any of you.

Cheers, Shai.

Monday, June 21, 2010

Error 500 after installing SharePoint 2010 and Visual Studio 2010

Hi all,

Just and update on some frustrating behaviour I recently had.
The solution is so simple it's annoying to let anyone else struggle with it...

Well, I went ahead and installed SharePoint 2010 on my Win7 64 bit laptop.
In stand alone mode, everything was going great!
here is a link to a great step by step guide for doing that: http://msdn.microsoft.com/en-us/library/ee554869.aspx

OK, once I was done - SharePoint was working great and at lightning fast speed!

Next I wanted to install Visual Studio 2010 on that same machine, so I ran the installer and chose to install C#, Web developer and among other things the SQL express that comes with it.

Installation, again, was going smoothly.

After a reboot - I noticed that SharePoint had stopped working, and any page I tried to access gave me server error 500... even the central administration!

Naturally, I ran the SharePoint configuration wizard and hoped it will make everything better again... only to find out it reports that my configuration database is not available!

So, first step was to fix the DB not available thing... that was easy:
apparently installing VS with its SQL express had stopped the SharePoint SQL instance and all I had to do was to start it, using services or using the start menu -> "SQL Server Configuration Manager":


OK - that allowed me to complete the SharePoint configuration wizard, but did not resolve the server error 500 I keep getting hitting any SharePoint page.

SharePoint log files were useless, which means that the error came before SharePoint code was even called.

Windows log viewer was very helpful on this, reporting an ISAPI filter that could not be loaded and caused the site load to abort: "Could not load all ISAPI filters for site/service. Therefore startup aborted"
Followed by another message:
"ISAPI Filter ‘C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349."

After a little trial and error, I have noticed that the ISAPI filter DLL file is being loaded from the 32 bit framework folder. Changing that manually to 64 bit in all my sites solved the problem!
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll

So, while I am not sure of why this is happening, but at least here is how to fix it!

Tuesday, November 10, 2009

How to install WSP SharePoint Solution Package

Download the zip file: WSP Installer

Extract the batch file from the zip into the "send to" folder (for example: "C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\SendTo").
Now you can simply use "right click -> send to -> install WSP" to install any WSP file.