UppubDate: Imtech Get SPMetal Definition Extension v1.1


A couple of days ago I published the Imtech Get SPMetal Definition Extension - an extension for the new Visual Studio SharePoint development tools that allows you to generate the SPMetal code for an existing SharePoint Site from the SharePoint Server Explorer. Just a few hours after publishing it I got some great feedback from Jeremy Thake (SharePoint Dev Wiki) that I decided to include in the tool.

First of all there was a bug in the extension. While generating the SPMetal code for the Root Site, the code included a textual warning that caused the code not to compile. SPMetal works in two modes: it allows you to output the generated code either to the console window (output stream) or a file. As I wanted to get the output and add it as a new file in Visual Studio, I thought that a string would be easier to process. Unfortunately, there is no distinction between where the code ends and the remark starts. String replace would be an option, but then would it really work in non-English SharePoint setups….? That’s why I decided to make SPMetal output the code to a temp file and then use that file in Visual Studio.

Jeremy had also another remark about how Imtech Get SPMetal Definition Extension worked. After having generated the SPMetal code, the code file would just be displayed in Visual Studio. While saving the code you would still have to navigate to the folder where the project is stored, save the file, add it to the project and additionally add a reference to Microsoft.SharePoint.Linq assembly. All of this has been fixed in v1.1. Right now, if you have a project open, the generated code file will be added to the active project and a reference to the Microsoft.SharePoint.Linq assembly will automatically get added to your project. If there is no project open, the extension falls back to the “old” behavior and just shows the code file that you can save anywhere you want.

The new version is available for download from the Visual Studio Gallery as well the Visual Studio Extension Manager.

Thanks Jeremy!

Technorati Tags: SharePoint 2010,Visual Studio 2010

Others found also helpful: