SharePoint 2010 and VS2010: Post-Deployment Scripts

Context

You are developing a SharePoint 2010 application using Visual Studio 2010 on a Windows 2008 64-bit server. You want to run a post-deployment script (PowerShell for example) for debugging:

image

The Problem

When you add a script, for example: powershell $(ProjectDir)\PowerShellScript\MySuperPowerShellScript.ps1

You always get an error when running the script:

Error occurred in deployment step ‘Run Post-Deployment Command’: The command "powershell $(ProjectDir)\PowerShellScript\MySuperPowerShellScript.ps1" exited with error code: 1.

This error is due to the fact that VS2010 runs in 32-bit mode, as well as its post-deployment scripts, and the SharePoint 2010 APIs run in 64-bit mode. This creates errors when executing the script.

[Read More]

I received a Windows Phone 7

Well, it may not be connected to a cellular network and it may be second-hand, but yesterday I received a Samsung Taylor for Windows Phone 7 (WP7) development!

I had fun with it last night and I am very satisfied with the device. Obviously, since it is a pre-production development device, it does not have all the features of a production phone. But all in all, it has all the functionalities of WP7.

[Read More]

[VS2010 Tips] Multi-line Insertion

While reading the MSDN article on converting VBA applications to C# 4.0, I remembered the famous ALT+[Selection] function that allows you to insert the same text/code on multiple lines at once. So, here is the English version of that part of the article:

Press ALT and select where you want to insert your code (selection in light blue in the image below):
image
Type your code and boom! All the selected lines have been filled with your code:

[Read More]

Unveiling Microsoft LightSwitch

Microsoft has just unveiled LightSwitch, a tool for developing business applications without having to touch the code. Jason Zander provides an excellent introduction on his site.

There will be a template for C# and VB. At first glance, the generated application seems to run on WPF for the Desktop version, and probably Silverlight or XBAP for the web version.

The beta will be available on August 23rd.

Stay tuned

How to Create Your StyleCop Rules

StyleCop is a free tool from Microsoft that allows you to check the style of your code (or others’). Additionally, StyleCop is now available as Open Source (on Codeplex), so I strongly recommend looking at the default rule implementations to help you create your own.

Create Your Rules

Here are some steps to create your custom StyleCop rules:

  • Install the latest version of StyleCop
  • Download the SDK of StyleCop (documentation .chm file)
  • Start Visual Studio
  • Create a new project of type “Class Library”
  • Add the following references - Microsoft.StyleCop - Microsoft.StyleCop.CSharp - Microsoft.StyleCop.CSharp.Rules

StyleCop_SolutionExplorer

[Read More]