Publishing for Web Applications from MSBuild

A search on this topic yields many answers for all the different possible combinations of Visual Studio web projects. Here is another.

Using .Net 3.5 MSBuild.exe take note of the following targets and the custom parameter, WebProjectOutputDir, passed when attempting to publish a web application project.

  • /t:ResolveReferences;_WPPCopyWebApplication
  • /p:WebProjectOutputDir=”c:\\Source\\Build\\My Web App\\” – this is the path to the output directory, all ‘\’ must be replaced with ‘\\’

A complete call will look something like this:

msbuild.exe MyWebApplication.csproj /p:Configuration=Release /t:ResolveReferences;_WPPCopyWebApplication /p:WebProjectOutputDir=”c:\Source\Build\My Web App”

The custom tool ‘MSLinqToSQLGenerator’ failed. Unspecified error

There is an issue in SP1 for Visual Studio 2008. If you have a partial class with Using statement at the top of the file for a Linq-To-SQL Data Classes context object. You will get above error. Visual Studio will delete the corresponding “.designer.cs” file for your data context and nothing will be compiled.

To solve this issue, you may have to move “Using” statements inside namespace declaration. This is a workaround provided by Microsoft.

Error when loading DMBL: could not retrieve the current project

Tried to open up my dmbl (containing my linq-to-sql objects) file and Visual Studio threw up a dialog saying that “a validation error occured please resolve and then try to re-open the file, see the error list for more details.”

The error list contained the following helpful message: could not retrieve the current project

Solution: Launch Visual Studio with the following command devenv /ResetSkipPkgs

Visual Studio 2008 SP1 crashes when adding items to the toolbox

I recently noticed that my VS 2008 SP1 crashes whenever I try to add items using Toolbox > Choose Items. This was a pain since I wanted to use the Ajax Control Toolkit in my project. Googling provided three solutions. The first two are listed here. But the one that worked for me was to start the studio in safemode using ‘devenv /safemode’ and then to run through each of the tabs accepting any acceptions raised, and then to restart the studio in normal mode.

Click, click, click

I’ve been looking at ways to keep my index finger away from the left mouse button. Other than learning to use the mouse with my left hand or switching the primary and secondary buttons, via the control panel, learning to use keyboard shortcuts is the way to go. So here are a few resources to help: