Visual Studio Extension: SPDeployer

With SharePoint 2013 you can create great solutions not only with a "SharePoint Hosted-App", but with a plain JavaScript file within a Content Editor Web Part. Vesa Juvonen named it app script part pattern.

So development today is like:

  • Open the style library in Explorer and open the javascript file with your favorite editor. Not ideal, because you are not working within a solution in Visual Studio, so no source control integration, etc.
  • Use SharePoint Designer to work with the files –> Not a development environment you want to work with


Here comes my Visual Studio extension to the rescue. Install it directly from within Visual Studio->Tools->Extensions and Update. Search for SPDeployer or download directly from the Visual Studio gallery.

Open a solution with your web project, then click Tools->"Add SPDeployer to project". This will add a new spdeployer.config file to the currently selected project.


Just enter the details to you SharePoint dev site and add a line for each file you want to have SPDeployer automatically upload on save.

Now whenever you make changes in one of the monitored files, it will automatically upload to your SharePoint library.

You can find the sources on GitHub. Feel free to add issues or pull requests.

Load Testing SharePoint with Visual Studio Online

I recently discovered that Visual Studio Online includes 15000 "Virtual User Minutes" for load testing each month for free. I've never used the load test feature of Visual Studio before, so I decided to try it to simulate high user loads on our SharePoint farm. Here is a step-by-step guide.


  • A Visual Studio Online account
  • Visual Studio 2013 Ultimate (Performance and Load Testing is not included in any other edition)
  • SharePoint Site which is accessible via Internet


In Visual Studio 2013 go to File->New->Project and select "Web Performance and Load Test Project" in category "Test":


This will create an empty "Web Performance Test". To start recording what the test should do, click "Record" and an IE Browser window will open.

image image

Now open your SharePoint site and click around to simulate some browsing. After that click "Stop" to come back to Visual Studio where you will see all requests in your Web Performance Test.

You might not want to record some "SharePoint" noise, so there is a settings page to exclude some stuff. Go to Visual Studio Tools->Options->Web Performance Test Tools->SharePoint:


To execute this Web Performance Test as a load test with simulated users, you have to add a "Load Test" to your project:


The wizard will guide you through some configuration options. Set the load to 250 users as shown below for a test running one minute will cost you 2500 virtual user minutes. So keep in mind that the free plan of Visual Studio Online gives you 15000 virtual user minutes per month. Be careful with the constant loads settings, because all virtual users will submit the first request as fast as possible, so the result may not reflect real usage scenarios. For more users use the "Step" pattern to start with a few users. They will automatically increase over time.


I set the test mix model to "Based on sequential test order" because there is only one test in my project which every virtual user should run. In the next step add the existing test to the load test.

I leave Network Mix, Browser Mix and Counter Sets untouched. In Run Settings I set the "Load test duration" to 10 which means, every virtual user will execute the test in a loop for 10 minutes.


With these settings, your "Virtual User Minute" budget of 15000 in Visual Studio Online will decrease by 2500 (250 user * 10 minutes).

Run in the Cloud

Now add a .testsettings file (Local.testsettings already exists) via Add->New Item and search for test:


Give it a name like "CloudTestSettings". A wizard will open where you can select "Run tests using Visual Studio Team Foundation Service" (what is now "Visual Studio Online" as of November '13).


Make sure, your newly created .testsettings file is the active one by right click on it and select "Active Load and Web Test Settings":


Ok, that's basically all you have to do. If you already know some values and want to visualize threshold violations, you can open the load test and add threshold rules to one ore more counters. For example to the average page load time.


To run the load test, just click "Run Load Test":


After the test is completed the result panel show all the details about the test. You can add counters to graphs and see a summary and details. I'm interested in the page response times, so I switch to only one graph layout. Here you can see all the different pages and there response times.


You can download the report to Excel to analyze it even further.

Delete project from

Just a short reminder for me, how to delete a project from, because there is no UI to do that:

Open a Developer Command Prompt and type:

tfsdeleteproject /force /collection: "YourProjectName"

SPC12: Tag 1

Heute morgen ging es ab 7:30(!) mit dem Frühstück in einer Halle los, in der sonst wahrscheinlich Flugzeuge oder Raketen gebaut werden.















Dann anschließend in einer ähnlich großen Halle gab es die Keynote mit u.a. Jared Spataro, Jeff Teper und Scott Guthrie. Neben den bereits bekannten Dingen wurden auch die Windows 8 Apps für SharePoint und Yammer gezeigt. Insgesamt ist die Yammer Integration aber noch nicht wirklich eine Integration. Man springt klar von einer Anwendung zur nächsten, was das ganze in meinen Augen ziemlich User-Unfreundlich macht. Was aber klar wird: Microsoft setzt ganz extrem auf die Cloud. Dazu wurde z.b. gesagt, dass sie sich von dem 3-Jahres Releasezyklus verabschieden und in Office365 alle 90 Tage Updates einspielen.

Anschließend war ich dann in der Session "What's new for Developers in Office 2013 and SharePoint 2013". Dort gab es leider nicht viel Neues, sondern nur noch mal einen Überblick über die Möglichkeiten der Apps, die dann in Office, SharePoint und Outlook laufen.

Nach dem Mittag ging es weiter mit "What's new in Search for SharePoint 2013". Sehr interessant und insgesamt super mächtig was die Suche nun für Möglichkeiten bietet. Sei es beim Ranking, bei der Präsentation oder den Query Rules. Vor allem wichtig: Um die Suchergebnis-Seite und das Hover-Panel zu bearbeiten ist kein XSLT mehr notwendig sonder nur noch HTML/Javascript.

Danach war ich noch bei der Session "Building end-to-end apps for SharePoint with Windows Azure and Windows 8". Dort wurde eine Lösung gezeigt die fast alle neuen Technologien vereint und von Public Sites bis Windows 8 Toast/Tile Notifications alles hatte. Sehr cool. Allerdings fehlte leider die Zeit wirklich in alle Details zu schauen.

CIMG0099Heute abend dann noch bei der ClubSPC Party gewesen. Und Mr. Gangnam Style persönlich war da (oder zumindest einer der genauso aussah ;-)

Und zum Schluß noch ein Lacher: Woran merkt man, dass man auf einer SharePoint- (oder Allgemein einer IT-) Konferenz ist? An diesen Schildern.

Visual Studio Achievements

Viele kennen sicher diesen Blog Eintrag. Sehr lustig, und nun gibt es sie wirklich, die VS Achievements.

Dank Channel9 gibt es neben der Visual Studio Extension auch noch eine REST API und ein fertiges Widget. Meine Achievements seht ihr rechts in der Leiste. Einige sollten aber eher Minuspunkte geben... ;-)

Also ladet euch die Extension runter und sammelt fleißig Achievements.

NuGet Package Manager or How to make “source code sharing” across projects much better


In a company with more than one development project sometime it happens that someone says: Hey, we need a common logging component shared across all projects.
Now the solution could be to develop such a logging component and share the assembly with all projects. However, if there is some code that should/must be unique to each project it is a bit more complicated. If you want to do that with SharePoint 2010 and build a logging component on top of the ULS log and want each project to be configurable in the Central Administration you need to know all future projects and categories or you need some unique code.

Note: The logging component is only a very easy example and might not be the best one.


Microsoft created NuGet. A package manager for Visual Studio. Quote of the official site:

NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio.

You can add it easily to Visual Studio 2010 by Tools->Extension Manager. Search for “NuGet”. After it is installed, you can add packages to a project by right clicking on a project in the Solution Explorer and click “Add Library Package Reference…”


Now as a company you don’t want your super-fancy code to show up for everyone as open-source. Therefore, NuGet can have more than one package source. You can even use a file share. Open Tools->Library Package Manager->Package Manager Settings:

image image

Bring it together

To get rid of “each project copy the source from the source of the other project from the source of the source of the source from another project” you can now use NuGet.

The idea is:
- Create the Logger.cs file
- Add TODOs to the code where the developer need to change something
- Make a NuGet package from it
- Let the project teams use the NuGet package (and distribute updates to the source automatically as well!)

Advantage: There is only one source! And if the owner of the NuGet package updates it, all project teams will be automatically notified about an update!

Create the NuGet package

In my example I talk about the comon logger component. A single Logger.cs file. However, NuGet can handle even more complex packages with PowerShell code, etc.

So download the NuGet command-line tool and create a new folder where all the stuff for the package will go to.

Open a command prompt and enter:

nuget spec

This will automatically create an empty package specification file called Package.nuspec. Open this file in notepad and modify the required values. Also rename the file to match the id property.


Now create a folder called “content”. Everything in this folder will be merged into the solution on installation of the package. So I put the file Logger.cs in this folder.
However, I don’t want that all users are required to use the same namespace, so you can change the file extension to “.cs.pp” to let NuGet “pre-process” the file.

Within the file you can then set some tokens to be replaced on installation. You can find a list of available properties here on MSDN.

The folder structure looks like this:


And the Logger.cs.pp in the content folder:


As you can see, I used the token $rootnamespace$. That one will be replaced by the root namespace of the target project.

Ok, lets make a package:

nuget pack

The output is a file called SPLogger.1.0.nupkg. You can publish it to the official NuGet package server or use it only internally by copying it to a file share.
Now open Visual Studio add the file share as a package source and search for it in the “Add Library Package Reference” window or open the NuGet console in Visual Studio (View->Other Windows->Package Manager Console) and type:

Install-Package SPLogger


That’s it. If you change the version number in your .nuspec file, create a new package and copy it also to your file share, the project team can decide to update to the latest version in the “Library Package Reference” dialog. You can even uninstall the package and everything will be removed from the project without leaving anything behind.

Proxy Switcher v1.5 – How to create your own switcher?

Proxy Switcher arbeitet derzeit mit dem Internet Explorer und Firefox zusammen. In der Regel greifen Anwendungen automatisch auf die Proxy Einstellungen des Internet Explorers zurück, weshalb es normalerweise vollkommen ausreichend ist.

Hat man nun aber einen Sonderfall, also eine Applikation die nicht auf die Internet Explorer settings zurückgreifen kann, benötigt man ein zusätzlichen “Switcher”.

In diesem Artikel zeige ich, wie einfach es ist, selbst einen zu entwickeln und im Proxy Switcher zu verwenden.


Zunächst erstellt man ein neues Class Library Projekt im Visual Studio 2008. Dies ist auch mit der kostenlosen Variante Visual Studio 2008 Express (C# oder VB.NET) ohne Probleme möglich.


Als nächstes fügt man eine Referenz auf ProxySwitcher.Shared.dll hinzu. Dort befindet sich die benötigte Basisklasse.


Nun noch die Class1.cs Datei umbenennen, z.B. in DemoSwitcher.cs. Dadurch wird auch automatisch die Klasse umbenannt. Diese Klasse muss nun von der SwitcherBase Klasse erben, wofür außerdem das using statement hinzugefügt werden muss:


Über das SmartTag was erscheint wenn man SwitcherBase ausgeschrieben hat, lassen sich automatisch alle benötigten Methoden erzeugen. Das wären “DisableProxy”, “EnableProxy” und die Eigenschaft “Name”.


Über die Name Eigenschaft kann man einen Namen vergeben, der später dann im Proxy Switcher angezeigt wird.

Enable und Disable sollte sich von selbst erklären. Innerhalb der Methoden kann man auf this.CurrentProxyEntry zugreifen um die Daten abzurufen, die nun aktiviert/deaktiviert werden sollen.


Damit hätten wir die minimal Implementierung beendet.

Erweiterte Funktionen

Man kann nun noch für seinen Switcher Einstellungen laden und speichern und auch einen Settings Dialog als Windows Form anbieten (wofür dann noch eine Referenz auf “System.Windows.Forms” hinzugefügt werden muss):



Nachdem man alles soweit fertig hat, muss das Projekt noch kompiliert werden. Dadurch entsteht eine DLL, in meinem Fall PSDemoSwitcher.dll.

Diese muss nur noch in das Verzeichnis kopiert werden, wo auch ProxySwitcher.exe liegt. Also normalerweise “C:\Programme\ProxySwitcher”.

Startet man nun den ProxySwitcher, erscheint im ersten Tab direkt mein neuer Switcher und kann selektiert werden, damit er auch aufgerufen wird.




Die dokumentierte Beispielimplementierung gibt es hier zum download.

Windows 7: Open a new Form from the Jumplist

With the Windows API Code Pack, Microsoft released a really cool managed wrapper for most of the new Windows 7 features. See here for more details and download.

One thing you can do is to create a .NET app with Jumplist support. Jumplists are these cool menus appearing on right click on an icon in the task bar:


But there is something wrong with the jumplist: It can only launch new apps! The demo solution for the Code Pack launches notepad and some other things, but there is no word about how to open the same app but with a new form.

So here is my solution, which is not very nice, but it works like a charm.

AppInstance1 is running –> click on a jumplist item starts a new instance –> appInstance2 now knows, that this is the second instance, so appInstance2 calls appInstance1 through remoting (IPC) and terminates–> appInstance1 receives the remoting call und execute something.

Ok, how to implement this?

First of all, create a new Windows Forms app and go to the Program.cs file. Within this class create a new class which works as your service for the remoting part and also a static reference to your form:

static class Program
        public class RemotingService : MarshalByRefObject
            public RemotingService() { }

            public void ShowText(string text)

        internal static Form1 formMain;

Then you will need some remoting code for the communication. I created two methods “InitRemoting” and “CallRunningInstance”. InitRemoting is called from the main method if this is the first instance. CallRunningInstance is called if the main method detects, that this is the second instance.

For the detection I use a system wide mutex.

I hope you get the idea. Because there are some more lines of code I created a demo project for you to download:

 Download the entire working demo solution here.


K2 blackpearl: Command-line deployment hangs

I tried to deploy a K2 blackpearl process (developed and tested on server DEV in domain A) to a test environment (server TEST, domain B) via the command line, but it freezes at some stage.

Normally you could deploy a process from within Visual Studio with a click on “Deploy”. Then you will get a wizard to choose your environment. If your environments are not on the same domain, K2 blackpearl supports the deployment through the command line.

In Visual Studio right click on the process and select “Create Deploy Package”. After it finishes, you will find some files in the obj\Debug folder. One file is a .msbuild file.

I copied all files, as mentioned in the K2 docu, to the target machine and fired up:
msbuild MyProcess.msbuild /p:Environment=Test

First, it looks good, because my InfoPath form was deployed to the SharePoint site, then the console showed the following lines:

Deploy Processes: Task Started (26.02.2009 17:00:00)
Adding Process : MyProcess\Demo1

Nothing more! I waited about 30 minutes, but nothing happened, no error messages, nothing.

Long story short: The solution is, that the value of the “SharePoint Target Site” environment field MUST end with a “/” (e.g. “http://mossServer/targetSite/”)! You can change this within Visual Studio in the Environment Browser or directly in the .msbuild file.

No more comments…

Publish a page with onet.xml as “published”

If you ever tried to publish one or more pages with your site definition (by onet.xml), you see in Visual Studio (with the SharePoint XSD schemas selected) only one valid value for the “Level” attribute which is “Draft”:


But for this attribute you can choose between every value of the SPFileLevel enum. So for publishing the page automatically, set the Level to “Published”. Thats it.

If you already know how to enable XSD schema validation and IntelliSense support stop reading here.

Enable Schema Validation:

  1. Open your xml file, e.g. onet.xml (works with all SharePoint related xml files)
  2. In the property pane, click the ellipsis next to the “Schemas” property
  3. Add the wss.xsd. This file is located in the 12\Template\XML directory
  4. Now add the following xml Namespace attribute to the root element (here Project in onet.xml):
  5. <Project xmlns="" Title="" [...]

Now you should have IntelliSense and schema validation enabled.