The SI SharePoint Blog

Development with SharePoint 2010

Author Archive

Getting around GAC problems when you deploy SharePoint solutions with PowerShell

with one comment

In a previous post I wrote about how to replace the Visual Studio deployment steps with your own PowerShell script, which allows you to take full control over how you deploy solutions to your development machine.

In addition to enabling more advanced deployment scenarios, this allows you to use the same scripts when you deploy locally and to your test and production environments. The Visual Studio deployment engine is great – but it’s almost too helpful. It cleans up everything for you, automatically fixing all kinds of deployment conflicts.

This creates an artificial environment. In test or production, it’s possible that you never want to actually retract and reinstall your solution, just update it, and if you do reinstall it, Visual Studio is not around to fix deployment conflicts for you. So you may be headed for a nasty surprise when you take your solution to a test server for the first time, and discover there are all sorts of upgrade scenarios to consider.  (For instance, it’s really difficult to overwrite existing files.)

Read the rest of this entry »

Written by Bjørn Stærk

March 26, 2010 at 2:56 pm

Make your own PowerShell scripts for SharePoint deployment in Visual Studio 2010

with 2 comments

The SharePoint developer tools in Visual Studio 2010 allow you to deploy the solution you’re working on directly to a SharePoint site.  The deployment steps are both configurable and extensible: You can choose which deployment steps you want to perform (add solution, activate features, etc.), and it is also possible to define your own custom deployment steps in a Visual Studio extension.

The configuration options are fairly limited.  For instance, you can choose to “activate features” as part of the deployment.  But what if you have multiple features in your solution, and you normally only want to activate some of them?  You could move the rest into their own solution, but that’s an ugly way to solve this.  What then?

Read the rest of this entry »

Written by Bjørn Stærk

March 25, 2010 at 4:11 pm

Changing the disk location of uncustomized (ghosted) pages

with one comment

Files that have been added to SharePoint can be either customized or uncustomized.  Customized means the data lives in the database.  Uncustomized means the entry in the database just points to a location on the disk.  When you change an uncustomized file on a particular site, for instance using SharePoint Designer, it becomes customized, and is moved into the database.

Read the rest of this entry »

Written by Bjørn Stærk

March 2, 2010 at 2:10 pm

Posted in Uncategorized

“The language-neutral solution package was not found”

with 4 comments

We sometimes get this error when deploying SharePoint 2010 (beta 2) solutions from Visual Studio 2010:

Error occurred in deployment step ‘Retract Solution’: The language-neutral solution package was not found.

We don’t know why this happens, possibly some beta problem, but one solution is to call the Delete method on the solution directly, using PowerShell:

(get-spsolution mysolution.wsp).Delete()

You can also run get-spsolution without parameters to see which solutions are currently installed in the farm.

Written by Bjørn Stærk

January 28, 2010 at 12:58 pm

Getting multiple layers of web.config modifications to live together

leave a comment »

In our SharePoint 2010 solutions we have web.config modifications that are standard, and custom modifications that are later added on top of the standard ones.  This article describes a way for multiple levels of modifications to live together, in a way that supports upgrades of the standard modifications without destroying the custom ones.

Before you read this you should be familiar with the web config modification framework in SharePoint.  It’s important never to modify SharePoint web.config files directly, especially when you’re deploying your solutions to a farm environment.

Read the rest of this entry »

Written by Bjørn Stærk

January 22, 2010 at 11:00 am

Using the FeatureUpgrading event to upgrade features

with 4 comments

In SharePoint 2010 there is now a way to control how features are upgraded from one version to another.  Here’s how to get it working, using the new FeatureUpgrading event in the feature receiver class.

Read the rest of this entry »

Written by Bjørn Stærk

January 21, 2010 at 12:21 pm

Time to replace stsadm with PowerShell

with 2 comments

One thing in SharePoint 2010 I appreciate as a developer is the close integration with PowerShell.  PowerShell is the result of a bit of Unix envy at Microsoft.  Unix systems have had good command-line tools and scripting languages since the dawn of time.  Windows had cmd.exe, which was inferior 20 years ago when it was known as MS-DOS, and hasn’t been changed since.

But when PowerShell finally did arrive, in 2006, it was as good as the Unix alternatives, and in one important way superior: Object piping.  PowerShell allows you to string commands together and pipe the results of one as input to the next, as .Net objects.  In a SharePoint 2010 context, that allows you to do this:

Read the rest of this entry »

Written by Bjørn Stærk

January 12, 2010 at 8:59 am

BCS first impressions

leave a comment »

The right way to think of Business Connectivity Services in SharePoint 2010 is probably as a pipe you can attach your data to, and, once you’re connected, that pipe can take you anywhere within SharePoint and Office.  One shouldn’t be taken in by the hype here – this is the sort of functionality Microsoft often oversells as a magical tool for anything – but within the limitations BCS looks like a really useful technology for anyone who has data in various systems that they want to display in a SharePoint context.  Which is probably everyone.

There are four approaches to BCS, two of them are comparatively easy and can be used with SharePoint Designer, and the other two are more difficult and are used with Visual Studio.

Read the rest of this entry »

Written by Bjørn Stærk

January 6, 2010 at 2:03 pm

SharePoint 2010 beta – day 2

leave a comment »

SharePoint 2010 and Visual Studio 2010 really does a lot to improve working conditions for developers, by doing the initial XML plumbing involved in making features etc. for you.  But of course when something goes wrong you still have to know what it all means.  The configuration technology hasn’t actually become simpler, but you can expect to spend less time dealing with it, and more time actually making stuff.

The developer dashboard is one of these neat developer features.  It displays the time taken for each database query, web part etc. that runs on the page you’re looking at.  And you can extend it yourself by using SPMonitoredScope.

I ran into an interesting problem getting the developer dashboard to work. To enable the developer dashboard, you run:

stsadm -o setproperty -pn developer-dashboard -pv OnDemand

At first I mistyped the property-name as developer-dsahboard.  Stsadm didn’t give any error messages, just its normal cheerful “can do!” message, so I couldn’t understand why the dashboard didn’t appear in the menu.  When I called getproperty (with the same typo), it returned the value I had set.  Does this mean that you can just create your own custom farm-wide properties by typing in a name that isn’t already in use?  I can think of some uses for that.

SharePoint Designer looks really good.  I’ve always been uncomfortable with it, because the customization you made were difficult to package and deploy elsewhere.  It remains to see if and how this has been improved, but with 2010, SharePoint Designer has also become a powerful administration tool for SharePoint data, and will probably be popular with anyone who administrates or configures SharePoint solutions for that reason alone.

What’s impressed me most so far is everything you can do with lists.  You can query them with LINQ, access them remotely with the client object model, and also with REST services.  The underlying technology hasn’t changed much, but it has become easier to use the data in interesting ways.  And with BCS and external lists to provide external data sources, things could get really interesting.  That’s next on my list of things to check out.

Written by Bjørn Stærk

December 18, 2009 at 5:36 pm

SharePoint 2010 beta – Day 1

leave a comment »

So now I’ve installed SharePoint Server 2010 beta 2, along with the Office beta and the Visual Studio beta – I wonder if all this beta software will turn me into a nervous wreck before long.

I’m running on Windows 7, and followed this guide on MSDN.  It’s not difficult, but there are many manual steps, and I hope this will be unnecessary in the final release.

After installation, the Configuration wizard gave the following error during the sample data step: “Unrecognized attribute ‘allowInsecureTransport’”.  I solved that by running this hotfix, (thanks, The 14 Folder), restarting, and running the configuration wizard again.

Next I jumped into these hands-on developer labs, which seem like a great way to get some SharePoint dirt under your fingernails.  The documents refer to various data and PowerShell scripts that I couldn’t locate anywhere at MSDN, but if you’re familiar with SharePoint already you can probably adjust the code and/or create the missing data you need to make it work.

The first lab, on web parts and LINQ, gave me some problems.  With SharePoint 2010 you run spmetal.exe to generate the LINQ data context of a particular site, but this failed with the message “The Web Application at http://servername could not be found”.  The site existed, and I had access, but spmetal.exe couldn’t find it.  After some experimentation I solved it by turning off User Account Control.  I don’t know why that worked, but when you work with beta software you have to expect irrational behavior.

My first impressions are generally good. The changes appear to fall into three categories: UI changes (ribbon etc.), new technologies/services, and making life easier for developers.  All of them are welcome, and I look forward to exploring them further.

Written by Bjørn Stærk

December 17, 2009 at 5:21 pm

Follow

Get every new post delivered to your Inbox.