Custom NuGet Source for MSBuild

NuGet-Logo-2If you have a custom data source for your NuGet packages and you use MSBuild for your solutions, MSBuild will not be able to restore these packages.

To achieve this without adding specific configuration files to your .Net solutions, you just need to add a NuGetDefaults.config file in the %ProgramData%\NuGet\NuGetDefaults.config directory of your build server. This file will be opened at each build requiring package restoration and will allow you to see your enterprise or personal NuGet package sources.

[Read More]

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]