<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://community.sharpdevelop.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Matt Ward</title><link>http://community.sharpdevelop.net/blogs/mattward/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 SP2 (Build: 31113.47)</generator><item><title>TypeScript Support in SharpDevelop</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2013/04/24/TypeScriptSupportInSharpDevelop.aspx</link><pubDate>Wed, 24 Apr 2013 21:00:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:46669</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=46669</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=46669</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2013/04/24/TypeScriptSupportInSharpDevelop.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.3.1 now has support for &lt;a href="http://www.typescriptlang.org/"&gt;TypeScript&lt;/a&gt; with an early beta release of a new &lt;a href="https://github.com/mrward/typescript-addin"&gt;Addin&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;The Addin glues together the TypeScript language services, which provide all the features needed for code completion and refactoring, and SharpDevelop using &lt;a href="http://javascriptdotnet.codeplex.com/"&gt;Javascript.NET&lt;/a&gt; as the bridge between them. Javascript.NET allows SharpDevelop to host Google&amp;#39;s V8 JavaScript engine and have JavaScript code interact with .NET objects.&lt;/p&gt;
&lt;h2&gt;Features&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;TypeScript compilation on save or build.&lt;/li&gt;
&lt;li&gt;Code folding.&lt;/li&gt;
&lt;li&gt;Code completion&lt;/li&gt;
&lt;li&gt;Find references&lt;/li&gt;
&lt;li&gt;Rename refactoring&lt;/li&gt;
&lt;li&gt;Go to definition&lt;/li&gt;
&lt;li&gt;Quick class browser support.&lt;/li&gt;
&lt;li&gt;TypeScript syntax highlighting&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The addin supports:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SharpDevelop 4.3.1&lt;/li&gt;
&lt;li&gt;TypeScript 0.8.3.1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let us take a quick look at some of these features.&lt;/p&gt;
&lt;h2&gt;Code Completion&lt;/h2&gt;
&lt;p&gt;Code completion works when you press the dot character.&lt;/p&gt;
&lt;p&gt;&lt;img alt="TypeScript dot code completion" src="http://community.sharpdevelop.net/photos/mattward/images/original/TypeScriptDotCodeCompletion.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Code completion also works when you type the first bracket of a function.&lt;/p&gt;
&lt;p&gt;&lt;img alt="TypeScript function code completion" src="http://community.sharpdevelop.net/photos/mattward/images/original/TypeScriptFunctionCompletion.aspx" /&gt;&lt;/p&gt;
&lt;h2&gt;Find References, Go to Definition and Rename&lt;/h2&gt;
&lt;p&gt;These menu options can be found by right clicking on a class or a class member.&lt;/p&gt;
&lt;p&gt;&lt;img alt="TypeScript right click menu options" src="http://community.sharpdevelop.net/photos/mattward/images/original/TypeScriptTextEditorContextMenu.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Go To TypeScript Definition will show the corresponding type definition. Find TypeScript References will show the reference locations in the Output window. Rename will open a dialog box where you can type in the new name and click OK to have it updated everywhere it is referenced.&lt;/p&gt;
&lt;h2&gt;Getting the Addin&lt;/h2&gt;
&lt;p&gt;The addin&amp;#39;s &lt;a href="https://github.com/mrward/typescript-addin"&gt;source code&lt;/a&gt; is available on &lt;a href="https://github.com/mrward/typescript-addin"&gt;GitHub&lt;/a&gt;. A &lt;a href="http://community.sharpdevelop.net/blogs/mattward/TypeScript/TypeScriptAddin-0.1.zip"&gt;zip file is available to download&lt;/a&gt; containing the pre-compiled addin. Simply unzip the files and install into SharpDevelop using the Addin Manager. The Addin Manager is available by selecting Addin Manager from the Tools menu. Install the addin by clicking the Install Addin button and then restart SharpDevelop.&lt;/p&gt;
&lt;h2&gt;Configuring TypeScript Compiler Options&lt;/h2&gt;
&lt;p&gt;The compiler options are available from the Options dialog (Tools - Options) under the Text Editor category. Here you can change when the compiler is run and what options are passed to the compiler when generating JavaScript code.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Configuring TypeScript Compiler Options" src="http://community.sharpdevelop.net/photos/mattward/images/original/TypeScriptCompilerOptionsDialog.aspx" /&gt;&lt;/p&gt;
&lt;h2&gt;Limitations and Known Issues&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Limitation with multiple projects using TypeScript files in the same solution. All files are included in the same scope.&lt;/li&gt;
&lt;li&gt;Performance problems - currently doing work on the UI thread and also re-parsing all TypeScript files each time when a code completion action is triggered.&lt;/li&gt;
&lt;li&gt;Different behaviour to Visual Studio with classes show in the code completion window. Visual Studio only shows code completion for TypeScript files you have explicitly referenced in a comment. SharpDevelop shows everything in the current project.&lt;/li&gt;
&lt;li&gt;Unable to easily replace the existing SharpDevelop menu options such as Find References so the standard shortcuts will not work.&lt;/li&gt;
&lt;li&gt;No support for hovering over a type with the mouse and seeing a tooltip with information about the type.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=46669" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/TypeScript/default.aspx">TypeScript</category></item><item><title>NuGet Addin for MonoDevelop</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2013/01/07/MonoDevelopNuGetAddin.aspx</link><pubDate>Mon, 07 Jan 2013 18:41:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:44955</guid><dc:creator>MattWard</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=44955</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=44955</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2013/01/07/MonoDevelopNuGetAddin.aspx#comments</comments><description>&lt;p&gt;It has been a while since &lt;a href="http://community.sharpdevelop.net/blogs/mattward/archive/2011/01/23/NuGetSupportInSharpDevelop.aspx"&gt;NuGet support was added to SharpDevelop&lt;/a&gt; so, after David Fowler announced that he had got &lt;a href="https://twitter.com/davidfowl/status/276188287721414656"&gt;NuGet building under Mono&lt;/a&gt;, I had a look at porting the SharpDevelop addin over to &lt;a href="http://monodevelop.com"&gt;MonoDevelop&lt;/a&gt; and created a &lt;a href="https://github.com/mrward/monodevelop-nuget-addin"&gt;NuGet addin for MonoDevelop&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/mrward/monodevelop-nuget-addin"&gt;addin&lt;/a&gt; provides a &lt;strong&gt;Manage Packages dialog&lt;/strong&gt; that you can use to add, remove and update NuGet packages in a similar way to Visual Studio or SharpDevelop. Here is a screenshot of the &lt;strong&gt;Manage Packages dialog&lt;/strong&gt; open in MonoDevelop running on OpenSuse 12.2&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ManagePackagesDialog.aspx" alt="Manage Packages Dialog with package operation messages" /&gt;&lt;/p&gt;
&lt;p&gt;The addin has been tested with the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MonoDevelop 3.0.5&lt;/li&gt;
&lt;li&gt;Mono 2.10.9&lt;/li&gt;
&lt;li&gt;OpenSuse 12.2&lt;/li&gt;
&lt;li&gt;Windows 7&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The addin uses a &lt;a href="https://github.com/mrward/nuget/tree/monodevelop"&gt;slightly customised version of NuGet.Core&lt;/a&gt; based on the original &lt;a href="http://nuget.codeplex.com/SourceControl/BrowseLatest"&gt;NuGet&amp;#39;s source code&lt;/a&gt; available from the mono-build branch. The source code for this customised NuGet.Core is available on &lt;a href="https://github.com/mrward/nuget/tree/monodevelop"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Getting the Addin&lt;/h2&gt;
&lt;p&gt;The addin&amp;#39;s &lt;a href="https://github.com/mrward/monodevelop-nuget-addin"&gt;source code&lt;/a&gt; is available on &lt;a href="https://github.com/mrward/monodevelop-nuget-addin"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The addin is also provided as a pre-compiled binary available to download from a custom MonoDevelop repository:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mrward.github.com/monodevelop-nuget-addin-repository/3.0.5/main.mrep"&gt;http://mrward.github.com/monodevelop-nuget-addin-repository/3.0.5/main.mrep&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can add this repository to MonoDevelop via the &lt;a href="http://monodevelop.com/Documentation/Installing_Add-ins"&gt;Add-in Manager&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Please note that the addin is a beta release and more work is still to be done.&lt;/p&gt;
&lt;h2&gt;Manage Packages Dialog&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Manage Packages Dialog&lt;/strong&gt; can be opened from the &lt;strong&gt;Projects&lt;/strong&gt; menu by selecting &lt;strong&gt;Manage NuGet Packages&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It can also be opened by selecting the &lt;strong&gt;Solution&lt;/strong&gt; window, right clicking either the solution, the project or the project&amp;#39;s references and selecting &lt;strong&gt;Manage NuGet Packages&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;As a NuGet package is installed or uninstalled you can see the package operations that executed by expanding the &lt;strong&gt;Messages&lt;/strong&gt; section near the bottom of the dialog.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ManagePackagesDialogWithMessages.aspx" alt="Manage Packages Dialog with package operation messages" /&gt;&lt;/p&gt;
&lt;h2&gt;Configuring Package Sources&lt;/h2&gt;
&lt;p&gt;NuGet Package Sources can be configured in MonoDevelop&amp;#39;s options.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/NuGetPackageSourcesOptionsDialog.aspx" alt="Configuring NuGet Package Sources in MonoDevelop&amp;#39;s Options" /&gt;&lt;/p&gt;
&lt;p&gt;In Linux you can open the options dialog by selecting &lt;strong&gt;Preferences&lt;/strong&gt; from the &lt;strong&gt;Edit&lt;/strong&gt; menu. In Windows you can select &lt;strong&gt;Options&lt;/strong&gt; from the &lt;strong&gt;Tools&lt;/strong&gt; menu. In the Options dialog scroll down the categories on the left hand side until you find &lt;strong&gt;NuGet&lt;/strong&gt; and then select &lt;strong&gt;Package Sources&lt;/strong&gt;. Here you can add and remove NuGet package sources.&lt;/p&gt;
&lt;h2&gt;PowerShell&lt;/h2&gt;
&lt;p&gt;Any PowerShell scripts in a NuGet package will be ignored by the addin since Mono does not currently have support for them.&lt;/p&gt;
&lt;p&gt;There have been some attempts to implement PowerShell on Mono starting with Igor Moochnick who created &lt;a href="http://pash.sourceforge.net"&gt;Pash&lt;/a&gt; in 2008. Work on this was picked up &lt;a href="https://launchpad.net/pash"&gt;launchpad.net&lt;/a&gt; by Jonathan Ben-Joseph but that work stopped. The latest effort on bringing PowerShell to Mono is Jay Bazuzi with recent work done on the Pash source code available on &lt;a href="https://github.com/JayBazuzi/Pash2"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://pash.sourceforge.net"&gt;Pash on SourceForge&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://launchpad.net/pash"&gt;Pash on LaunchPad&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/JayBazuzi/Pash2"&gt;Pash2 on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There was also some &lt;a href="http://nuget.codeplex.com/discussions/246658"&gt;discussion in the NuGet forums&lt;/a&gt; on allowing some way of being able to write a &lt;a href="http://nuget.codeplex.com/workitem/720"&gt;.NET version of the PowerShell scripts&lt;/a&gt; (install.ps1, uninstall.ps1 and init.ps1).&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=44955" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/Mono/default.aspx">Mono</category><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/NuGet/default.aspx">NuGet</category><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/MonoDevelop/default.aspx">MonoDevelop</category></item><item><title>Code First Migrations with Entity Framework</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/11/11/CodeFirstMigrationsWithEntityFramework.aspx</link><pubDate>Sun, 11 Nov 2012 17:00:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:44701</guid><dc:creator>MattWard</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=44701</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=44701</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/11/11/CodeFirstMigrationsWithEntityFramework.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.3 now has support for Code First Migrations using Entity Framework 5.0.&lt;/p&gt;
&lt;p&gt;Microsoft added &lt;a href="http://msdn.microsoft.com/en-us/data/jj591621"&gt;Code First Migrations&lt;/a&gt; to Entity Framework in version 4.3 in February 2012. Code first migrations allows database changes to be implemented with code. The official Entity Framework NuGet package includes three  PowerShell cmdlets that extend the NuGet Package Manager Console allowing you to quickly create and use these code first migrations:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Enable-Migrations: Adds support for migrations to your project.&lt;/li&gt;
&lt;li&gt;Add-Migration: Generates code for a database migration based on changes to your database model.&lt;/li&gt;
&lt;li&gt;Update-Database: Applies migrations to the database.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The PowerShell cmdlets in the official EntityFramework NuGet packages are Visual Studio specific, but there is now a SharpDevelop specific NuGet package (EntityFramework.SharpDevelop) that allows you to use these PowerShell cmdlets in SharpDevelop. This has been made possible by &lt;a href="http://msdn.microsoft.com/en-US/data/ef"&gt;Entity Framework&lt;/a&gt; being &lt;a href="http://entityframework.codeplex.com/"&gt;open sourced&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The EntityFramework.SharpDevelop NuGet package includes the original EntityFramework.dll along with custom versions of the assemblies containing the PowerShell cmdlets -  EntityFramework.PowerShell.dll and EntityFramework.PowerShell.Utility.dll.&lt;/p&gt;
&lt;p&gt;Now let us take a look at how to use the EntityFramework.SharpDevelop NuGet package.&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;Before you begin you should have &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=1695"&gt;SQL Express&lt;/a&gt; installed. You will also need &lt;a href="http://build.sharpdevelop.net/buildartefacts/"&gt;SharpDevelop version 4.3.0.9134&lt;/a&gt; or above.&lt;/p&gt;
&lt;p&gt;We will look at using Entity Framework with a simple C# console application. This application will add a blog post to a SQL Express database and then read all the existing blog posts in the database. &lt;/p&gt;
&lt;p&gt;In SharpDevelop first create a new C# Console Application. Now open the NuGet Manage Packages dialog by right clicking the project and selecting Manage Packages. Search for the EntityFramework.SharpDevelop package in the main NuGet feed and click the Add button to add it to your project. A reference to the EntityFramework assembly will be added to your project and your app.config will be modified. &lt;/p&gt;
&lt;p&gt;Now we are ready to use Entity Framework to update and read from our database.&lt;/p&gt;
&lt;h2&gt;Using Entity Framework&lt;/h2&gt;
&lt;p&gt;First add a new Post class to your project.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class Post
{
    public int Id { get; set; }
    public string Title { get; set; }
    public string Text { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now add a new database context class.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class BloggingContext : DbContext
{
    public DbSet&amp;lt;Post&amp;gt; Posts { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will also need to add a using statement to the BloggingContext class so the EntityFramework&amp;#39;s DbContext class can be found.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    using System.Data.Entity;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now open your Program.cs and add a using statement for System.Linq.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    using System.Linq;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then in Program.cs update the Main method as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Program
{
    public static void Main(string[] args)
    {
        Console.Write(&amp;quot;Enter a post title: &amp;quot;);
        string title = Console.ReadLine();

        Console.Write(&amp;quot;Enter the post text: &amp;quot;);
        string text = Console.ReadLine();

        using (var db = new BloggingContext()) {

            var newPost = new Post {
                Title = title,
                Text = text
            };

            db.Posts.Add(newPost);
            db.SaveChanges();

            Console.WriteLine(&amp;quot;All posts in the database:&amp;quot;);

            IQueryable&amp;lt;Post&amp;gt; query = db.Posts
                .OrderBy(p =&amp;gt; p.Title)
                .Select(p =&amp;gt; p);

            foreach (Post post in query) {
                Console.WriteLine(&amp;quot;Post.Title: &amp;quot; + post.Title);
            }
        }

        Console.WriteLine(&amp;quot;Press a key to exit.&amp;quot;);
        Console.ReadKey();
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This code reads the blog post title and text entered on the command line, adds a new post to the database and then reads all the posts in the database. Compile and run this application and you should see output similar to the following.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    Enter a post title: First Post
    Enter the post text: Some text here...
    All posts in the database:
    Post.Title: First Post
    Press a key to exit.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After running this application Entity Framework will have created a new database with the same name as the db context class you created. In the screenshot below you can see the database open in &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=22985"&gt;SQL Server Express Management Studio&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/CodeFirstDatabaseCreatedByEntityFramework.aspx" alt="Code first database created by Entity Framework" /&gt;&lt;/p&gt;
&lt;p&gt;You can see that Entity Framework has created a Posts table as well as a __MigrationHistory table. Now we will take a look at enabling database migrations.&lt;/p&gt;
&lt;h2&gt;Enabling Migrations&lt;/h2&gt;
&lt;p&gt;Open the Package Management Console and enter the command.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    Enable-Migrations
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This adds a Migrations folder to your project along with a Configuration.cs file and an initial migration.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ProjectItemsAfterCodeFirstMigrationsEnabled.aspx" alt="Project items after migrations are enabled" /&gt;&lt;/p&gt;
&lt;p&gt;The Configuration.cs file can be edited to add seed data and alter other settings used when migrating the database. The initial migration files contain code to generate the Posts table in the database.&lt;/p&gt;
&lt;p&gt;Now let us take a look at adding a new migration.&lt;/p&gt;
&lt;h2&gt;Adding a Migration&lt;/h2&gt;
&lt;p&gt;We want to add a Published Date to our Post class. Add the new PublishedDate property to the Post class as shown below.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class Post
{
    public int Id { get; set; }
    public string Title { get; set; }
    public string Text { get; set; }
    public DateTime PublishedDate { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can generate a code first migration by entering the following command into the Package Management Console.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    Add-Migration AddPublishedDate
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This creates a new migration and gives it the name AddPublishedDate. A new file will be added to your migrations folder which contains the code to update the Posts table with the new PublishedDate column.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;namespace EFCodeFirst.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class AddPublishedDate : DbMigration
    {
        public override void Up()
        {
            AddColumn(&amp;quot;dbo.Posts&amp;quot;, &amp;quot;PublishedDate&amp;quot;, c =&amp;gt; c.DateTime(nullable: false));
        }

        public override void Down()
        {
            DropColumn(&amp;quot;dbo.Posts&amp;quot;, &amp;quot;PublishedDate&amp;quot;);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you can update your database.&lt;/p&gt;
&lt;h2&gt;Updating the Database&lt;/h2&gt;
&lt;p&gt;To update the database we run the following command in the Package Management Console window.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    Update-Database
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The new PublishedDate column will then be added to the Posts database table as shown in the screenshot below&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/PostsTableAfterCodeFirstMigrationApplied.aspx" alt="Posts table after code first migration applied" /&gt;&lt;/p&gt;
&lt;p&gt;That concludes the introduction to using Code First Migrations with SharpDevelop. More information on EntityFramework can be found on the &lt;a href="http://msdn.microsoft.com/data/ef"&gt;Microsoft MSDN site&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Changes Made to Original Entity Framework NuGet Packages&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Renamed NuGet package to EntityFramework.SharpDevelop and included files and assemblies from official EF NuGet package.&lt;/li&gt;
&lt;li&gt;Recompiled the EntityFramework.PowerShell and EntityFramework.PowerShell.Utility projects against SharpDevelop&amp;#39;s EnvDTE implementation.&lt;/li&gt;
&lt;li&gt;Small modifications to the project to compile against .NET 4.0 and the EntityFramework.dll. Microsoft&amp;#39;s released source code on Codeplex is for EntityFramework 6 and not for EF 5.&lt;/li&gt;
&lt;li&gt;EntityFramework.PowerShell and EntityFramework.PowerShell.Utility assemblies are no longer signed.&lt;/li&gt;
&lt;li&gt;Added workaround to fix AppDomain.CreateInstance failing to find constructors taking a EnvDTE.Project parameter.&lt;/li&gt;
&lt;li&gt;Add SharpDevelop.EnvDTE.dll to NuGet packages.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All the code for the modified NuGet packages are available on &lt;a href="https://github.com/mrward/entityframework-sharpdevelop/tree/ef5-nuget"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=44701" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/EF/default.aspx">EF</category></item><item><title>MVC Scaffolding</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/09/28/MvcScaffolding.aspx</link><pubDate>Fri, 28 Sep 2012 13:10:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:44455</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=44455</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=44455</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/09/28/MvcScaffolding.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.3 now has support for &lt;a href="http://mvcscaffolding.codeplex.com"&gt;MVC Scaffolding&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mvcscaffolding.codeplex.com/"&gt;MVC Scaffolding&lt;/a&gt;, maintained by &lt;a href="http://blog.stevensanderson.com"&gt;Steve Sanderson&lt;/a&gt;, provides a way to quickly generate code for views and controllers in your ASP.NET MVC application. It has support for scaffolding the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Views and controllers.&lt;/li&gt;
&lt;li&gt;Entity Framework DbContexts.&lt;/li&gt;
&lt;li&gt;Repositories.&lt;/li&gt;
&lt;li&gt;Controller actions.&lt;/li&gt;
&lt;li&gt;Unit tests.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It makes use of T4 templates, which can be customised, and can be extended with custom scaffolders to support more than just the features listed above.&lt;/p&gt;
&lt;p&gt;The original MVC Scaffolding NuGet packages made heavy use of the Visual Studio API and have been modified to work with SharpDevelop. Full details of the changes made to the original NuGet packages can be found at the end of this post.&lt;/p&gt;
&lt;p&gt;Steve Sanderson has a &lt;a href="http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/"&gt;great series of posts on MVC Scaffolding&lt;/a&gt; that covers more than this post will. Now let us take a look at how to use MVC Scaffolding with SharpDevelop.&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;MVC Scaffolding for SharpDevelop is available as a &lt;a href="http://nuget.org/packages/MvcScaffolding.SharpDevelop"&gt;NuGet package&lt;/a&gt;. The NuGet package you should download is &lt;strong&gt;MvcScaffolding.SharpDevelop&lt;/strong&gt;. Install the MvcScaffolding.SharpDevelop NuGet package either from the NuGet package management console or by using the Manage Packages dialog.&lt;/p&gt;
&lt;p&gt;Note that the NuGet package MvcScaffolding.SharpDevelop.1.0.9 requires SharpDevelop 4.3.0.9134 or above. If you have an older version installed then you should uninstall the MvcScaffolding.SharpDevelop package, before installing the latest version of SharpDevelop, and then reinstall the MvcScaffolding.SharpDevelop package. A breaking change made to SharpDevelop 4.3 to support the EntityFramework package will cause the older MvcScaffolding.SharpDevelop NuGet package to fail to uninstall cleanly in the newer version of SharpDevelop.&lt;/p&gt;
&lt;h2&gt;Scaffolding a Controller and Views&lt;/h2&gt;
&lt;p&gt;As an example we will create a simple blogging site. Create a Razor MVC application called BloggingSite. Then create the following class in a Models folder.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;using System;

namespace BloggingSite.Models
{
    public class Post
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public string Text { get; set; }
        public DateTime PublishedDate { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we can scaffold a controller and a set of Create, Read, Update and Delete (CRUD) views. In the Package Management console run the following command.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Scaffold Controller Post
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will generate a set of views, a controller and an Entity Framework database context.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/PackageManagementConsoleOutputForScaffoldControllerPost.aspx" alt="Scaffold Controller Post output in Package Management Console" /&gt;&lt;/p&gt;
&lt;p&gt;To run the Blogging Site application you will need to have IIS Express and SQL Server Express installed. Your project will also need to be configured to use IIS Express. Select &lt;strong&gt;Project Options&lt;/strong&gt; from the &lt;strong&gt;Project&lt;/strong&gt; menu and then select the &lt;strong&gt;Web&lt;/strong&gt; tab. Choose IIS Express and then click the &lt;strong&gt;Create application/virtual directory&lt;/strong&gt; button.&lt;/p&gt;
&lt;p&gt;Then run your application and visit the &lt;strong&gt;/Posts&lt;/strong&gt; page in your browser.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ScaffoldedPostsPageWithEmptyDatabase.aspx" alt="Scaffolded Posts page with empty database" /&gt;&lt;/p&gt;
&lt;p&gt;You can then create a new post by clicking the &lt;strong&gt;Create New&lt;/strong&gt; link.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ScaffoldedPostsCreateNewPostPage.aspx" alt="Creating new blog post page" /&gt;&lt;/p&gt;
&lt;p&gt;After creating a new post then the post will be displayed on the original /Posts page.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ScaffoldedPostsPageWithOnePost.aspx" alt="Scaffolded Posts page with one post" /&gt;&lt;/p&gt;
&lt;p&gt;Also scaffolded is the details page which you can view by clicking the &lt;strong&gt;Details&lt;/strong&gt; link.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ScaffoldedPostsDetailsPage.aspx" alt="Scaffolded Details page" /&gt;&lt;/p&gt;
&lt;p&gt;Finally there is the Delete page where you can remove a post.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/ScaffoldedPostsDeletePage.aspx" alt="Scaffolded delete post page" /&gt;&lt;/p&gt;
&lt;p&gt;Scaffolding CRUD views is just one part of MvcScaffolding so let us take a look at some of other scaffolding that is supported. Steve Sanderson goes into more detail on &lt;a href="http://blog.stevensanderson.com/2011/01/13/mvcscaffolding-standard-usage/"&gt;what you can do with each of the MVC Scaffolders&lt;/a&gt; than will be covered here.&lt;/p&gt;
&lt;h2&gt;Scaffolding a Repository&lt;/h2&gt;
&lt;p&gt;The PostsController generated uses the BloggingSiteContext class which is derived from Entity Framework&amp;#39;s DbContext. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class PostsController : Controller
{
    private BloggingSiteContext context = new BloggingSiteContext();

    //
    // GET: /Posts/

    public ViewResult Index()
    {
        return View(context.Posts.ToList());
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To allow unit testing of the controller we can instead using a repository interface which can be mocked. To do that we run the following command.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Scaffold Controller Post -Repository -Force
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default MVC Scaffolding will not overwrite views and controllers previously created in your project. In order to overwrite the views and controllers created previously we use the &lt;strong&gt;-Force&lt;/strong&gt; option.&lt;/p&gt;
&lt;p&gt;The PostsController now looks like this.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class PostsController : Controller
{
    private readonly IPostRepository postRepository;

    // If you are using Dependency Injection, you can delete the following constructor
    public PostsController() : this(new PostRepository())
    {
    }

    public PostsController(IPostRepository postRepository)
    {
        this.postRepository = postRepository;
    }

    //
    // GET: /Posts/

    public ViewResult Index()
    {
        return View(postRepository.All);
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Scaffolding an Empty View&lt;/h2&gt;
&lt;p&gt;You can scaffold an empty view by using the &lt;strong&gt;View&lt;/strong&gt; scaffolder and specifying the name of the controller, without the Controller part, followed by the name of the view.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Scaffold View Posts MyEmptyView
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In a Razor MVC application this will generate the file Views\Posts\MyEmptyView.cshtml in your project.&lt;/p&gt;
&lt;h2&gt;Scaffolding Database Context&lt;/h2&gt;
&lt;p&gt;You can scaffold extra properties for your database context by using the &lt;strong&gt;DbContext&lt;/strong&gt; scaffolder and specifying the model class and the name of the database context class. Create a new Blog class, as shown below.&lt;/p&gt;
&lt;p&gt;using System;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;using System;

namespace BloggingSite.Models
{
    public class Blog
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now run the command below to update your database context and a new Blogs property will be added to your BloggingSiteContext class.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Scaffold DbContext Blog BloggingSiteContext
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The new BloggingSiteContext class is shown below.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class BloggingSiteContext : DbContext
{
    // You can add custom code to this file. Changes will not be overwritten.
    // 
    // If you want Entity Framework to drop and regenerate your database
    // automatically whenever you change your model schema, add the following
    // code to the Application_Start method in your Global.asax file.
    // Note: this will destroy and re-create your database with every model change.
    // 
    // System.Data.Entity.Database.SetInitializer(
        new System.Data.Entity.DropCreateDatabaseIfModelChanges
            &amp;lt;BloggingSite.Models.BloggingSiteContext&amp;gt;());


    public DbSet&amp;lt;BloggingSite.Models.Post&amp;gt; Posts { get; set; }

    public DbSet&amp;lt;BloggingSite.Models.Blog&amp;gt; Blogs { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Scaffolding Controller Actions&lt;/h2&gt;
&lt;p&gt;You can scaffold new controller actions by using the &lt;strong&gt;Action&lt;/strong&gt; scaffolder and specifying the name of the controller, without the Controller part, and the name of the new action method.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Scaffold Action Posts MyAction
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will add a new MyAction method at the end of your PostsController class.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public ViewResult MyAction()
{
    return View();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It will also create an associated view.&lt;/p&gt;
&lt;p&gt;You can also scaffold actions that can have data posted to them. If you run the following command a new action will be created that takes a posted Blog object.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Scaffold Action Posts MyPostAction -ViewModel Blog -Post
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The PostsController will now have a new MyPostAction method at the end.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[HttpPost, ActionName(&amp;quot;MyPostAction&amp;quot;)]
public ActionResult MyPostActionPost(Blog blog)
{
    if (ModelState.IsValid) {
        return RedirectToAction(&amp;quot;Index&amp;quot;);
    } else {
        return View(blog);
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That is the end of our introduction to using MVC Scaffolding with SharpDevelop.&lt;/p&gt;
&lt;h2&gt;Modifications Made to Original MVC Scaffolding&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Mvc Scaffolding projects now compiled against SharpDevelop&amp;#39;s Package Management assembly which implements the Visual Studio API.&lt;/li&gt;
&lt;li&gt;T4 template generation now uses &lt;a href="http://community.sharpdevelop.net/blogs/mattward/archive/2011/06/26/T4TemplatesInSharpDevelop.aspx"&gt;MonoDevelop&amp;#39;s T4 Templating Engine&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;T4Scaffolding.SharpDevelop.1.0.8 NuGet package depends on EntityFramework.SharpDevelop NuGet package instead of the original EntityFramework NuGet package This allows an upgrade to the NuGet package EntityFramework.SharpDevelop.5.0.0 which supports migrations in SharpDevelop.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Source code for the modified MVC Scaffolding can be found on &lt;a href="http://mvcscaffolding.codeplex.com/SourceControl/network/forks/MattWard/mvcscaffolding"&gt;CodePlex&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[Update 2012-11-10]&lt;/strong&gt; Added information on MvcScaffolding.SharpDevelop 1.0.9 NuGet package requiring newer version of SharpDevelop. Updated &amp;quot;Scaffolding Database Context&amp;quot; section with example Blog class. Updated &amp;quot;Modifications Made to Original MVC Scaffolding&amp;quot; section with change made to T4Scaffolding.SharpDevelop NuGet package.&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=44455" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/NuGet/default.aspx">NuGet</category><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/T4/default.aspx">T4</category><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/AspNetMvc/default.aspx">AspNetMvc</category></item><item><title>Using T4MVC with SharpDevelop</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/09/15/UsingT4MVCWithSharpDevelop.aspx</link><pubDate>Sat, 15 Sep 2012 12:40:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:44326</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=44326</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=44326</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/09/15/UsingT4MVCWithSharpDevelop.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://build.sharpdevelop.net/buildartefacts/#SDMAIN"&gt;SharpDevelop 4.3&lt;/a&gt; now has support for  &lt;a href="http://t4mvc.codeplex.com/"&gt;T4MVC&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://t4mvc.codeplex.com/"&gt;T4MVC&lt;/a&gt; is a set of T4 templates, created by &lt;a href="http://blog.davidebbo.com/"&gt;David Ebbo&lt;/a&gt;, that will generate strongly typed helpers for an ASP.NET MVC application. It will allow you to remove strings from your MVC application making your application easier to maintain.&lt;/p&gt;
&lt;p&gt;So let us take a look at how to use T4MVC with SharpDevelop. First you should open or &lt;a href="http://community.sharpdevelop.net/blogs/mattward/archive/2012/01/29/AspNetMvcSupport.aspx"&gt;create a new ASP.NET MVC application in SharpDevelop&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Installing T4MVC&lt;/h2&gt;
&lt;p&gt;T4MVC is available as a &lt;a href="http://nuget.org/packages/T4MVC.SharpDevelop"&gt;NuGet package&lt;/a&gt;. The NuGet package you should download is &lt;a href="http://nuget.org/packages/T4MVC.SharpDevelop"&gt;T4MVC.SharpDevelop&lt;/a&gt;. This contains a modified version of the original T4MVC template that can be used with SharpDevelop. Further details on all the modifications made to the T4MVC template can be found at the end of this post. Install the T4MVC.SharpDevelop NuGet package either from the &lt;a href="http://community.sharpdevelop.net/blogs/mattward/archive/2011/06/05/NuGetPowerShellConsole.aspx"&gt;NuGet package management console&lt;/a&gt; or by using the &lt;a href="http://community.sharpdevelop.net/blogs/mattward/archive/2011/07/24/NuGet14.aspx"&gt;Manage Packages dialog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note that T4MVC 2.13.0 requires SharpDevelop 4.3.0.9132 or above.&lt;/p&gt;
&lt;p&gt;After installation two new T4 template files will be added to your project.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;T4MVC.tt - main template that generates the strongly typed helpers.&lt;/li&gt;
&lt;li&gt;T4MVC.tt.settings.t4 - holds configuration settings used by main T4MVC.tt template.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Generating T4MVC&amp;#39;s Strongly Typed Helpers&lt;/h2&gt;
&lt;p&gt;To run the T4MVC template manually, select it in the &lt;strong&gt;Projects&lt;/strong&gt; window, right click and select &lt;strong&gt;Execute Custom Tool&lt;/strong&gt;. This will generate a set of files as dependencies of the T4MVC.tt file.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/T4MVCGeneratedFiles.aspx" alt="T4MVC Generated Files in Projects window" /&gt;&lt;/p&gt;
&lt;p&gt;It will also make some modifications to your controller classes.  The T4MVC template will change your controller classes so they are &lt;strong&gt;partial&lt;/strong&gt;. It will also change your controller methods so they are &lt;strong&gt;virtual&lt;/strong&gt;. What has been changed will be recorded as warnings in the &lt;strong&gt;Errors&lt;/strong&gt; window.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/T4MVCWarningsInErrorsWindow.aspx" alt="T4MVC modified code warnings in Errors window" /&gt;&lt;/p&gt;
&lt;p&gt;When you make modifications to your application you do not want to have to keep running the T4MVC template manually each time to regenerate the strongly typed helpers. Instead you can configure your project to re-generate the strongly typed helpers on each build.&lt;/p&gt;
&lt;h2&gt;Generating T4MVC&amp;#39;s Strongly Typed Helpers on each Build&lt;/h2&gt;
&lt;p&gt;To do this you should open the options for the project. From the &lt;strong&gt;Projects&lt;/strong&gt; menu and select &lt;strong&gt;Project Options&lt;/strong&gt;. Open the &lt;strong&gt;Custom Tool&lt;/strong&gt; tab. In this tab you can choose to run custom tools on each build. In the screenshot below the project is configured to run T4MVC on each build. &lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/T4MVCCustomToolProjectOptions.aspx" alt="Project options configured to run T4MVC on every build" /&gt;&lt;/p&gt;
&lt;p&gt;If you want to run other custom tools  you can add filenames for items in your project either as a comma separated list or with each file on a separate line. Currently there is no support for wildcards when specifying filenames.&lt;/p&gt;
&lt;p&gt;Now that we have generated the strongly typed helpers let us take a look at how to use a selection of them.&lt;/p&gt;
&lt;h2&gt;Using T4MVC&amp;#39;s Strongly Typed Helpers&lt;/h2&gt;
&lt;h3&gt;View Names&lt;/h3&gt;
&lt;p&gt;In your _ViewStart.cshtml you may have a reference to a Razor layout page.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@{
    Layout = &amp;quot;~/Views/Shared/_Layout.cshtml&amp;quot;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can replace this string with a strongly typed helper.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@{
    Layout = MVC.Shared.Views._Layout;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Action Links&lt;/h3&gt;
&lt;p&gt;In your views you may be passing action names and controller names as strings &lt;a href="http://msdn.microsoft.com/en-us/library/dd505070(v=vs.100)"&gt;HtmlHelper.ActionLink(string linkText, string actionName, string controllerName)&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    &amp;lt;li&amp;gt;@Html.ActionLink(&amp;quot;Home&amp;quot;, &amp;quot;Index&amp;quot;, &amp;quot;Home&amp;quot;)&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;@Html.ActionLink(&amp;quot;Contact&amp;quot;, &amp;quot;Contact&amp;quot;, &amp;quot;Home&amp;quot;)&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Instead you can use code that looks like you are calling the controller method.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    &amp;lt;li&amp;gt;@Html.ActionLink(&amp;quot;Home&amp;quot;, MVC.Home.Index())&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;@Html.ActionLink(&amp;quot;Contact&amp;quot;, MVC.Home.Contact())&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;CSS Links&lt;/h3&gt;
&lt;p&gt;You may be using strings for links, such as for CSS files, in your views.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&amp;quot;@Url.Content(&amp;quot;~/Content/Site.css&amp;quot;)&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These can be changed to use the Links.Content helper class.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&amp;quot;@Links.Content.Site_css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That is a very quick introduction to T4MVC and covers only a few of the helpers it provides. Further information on T4MVC can be found on the &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/documentation.aspx"&gt;T4MVC Codeplex site&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Changes Made to Original T4MVC Template&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Visual Studio assembly references have been removed and replaced with a SharpDevelop assembly reference.&lt;/li&gt;
&lt;li&gt;Visual Studio namespace imports have been removed and replaced with namespace imports for SharpDevelop.&lt;/li&gt;
&lt;li&gt;Removed use of BeginInvoke/EndInvoke which was causing SharpDevelop to hang.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The SharpDevelop specific T4MVC template is maintained in a &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/t4mvc-sharpdevelop.aspx"&gt;repository on github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[Update 2012-10-11]&lt;/strong&gt; Added information on T4MVC 2.13.0 requiring a newer version of SharpDevelop 4.3. Updated &amp;quot;Changes made to original T4MVC template&amp;quot; section after SharpDevelop EnvDTE API was modified to follow Visual Studio&amp;#39;s API when using parameterised properties such as ProjectItem.FileNames() and CodeType.IsDerivedFrom()&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=44326" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/T4/default.aspx">T4</category></item><item><title>NUnit 2.6.1 Support</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/08/12/NUnit261Support.aspx</link><pubDate>Sun, 12 Aug 2012 14:05:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:43106</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=43106</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=43106</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/08/12/NUnit261Support.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.3 has been updated to use &lt;a href="http://nunit.org/index.php?p=releaseNotes&amp;amp;r=2.6.1"&gt;NUnit 2.6.1&lt;/a&gt; which was recently released. The full details on what has changed in NUnit 2.6.1 can be found in the &lt;a href="http://nunit.org/index.php?p=releaseNotes&amp;amp;r=2.6.1"&gt;NUnit release notes&lt;/a&gt;. One change in this release caused some of SharpDevelop&amp;#39;s own unit tests to break so this change is highlighted in the following section. &lt;/p&gt;
&lt;h2&gt;Running unit tests with an STA thread&lt;/h2&gt;
&lt;p&gt;NUnit 2.6 no longer reads settings from your test configuration file (app.config). This means that you can no longer make NUnit use the STA thread by &lt;a href="http://stackoverflow.com/questions/2434067/how-to-run-unit-tests-in-stathread-mode"&gt;setting the default apartment state in your app.config&lt;/a&gt; file. So the following app.config file will not work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;configuration&amp;gt; 
    &amp;lt;configSections&amp;gt;
      &amp;lt;sectionGroup name=&amp;quot;NUnit&amp;quot;&amp;gt;
        &amp;lt;section name=&amp;quot;TestRunner&amp;quot;  type=&amp;quot;System.Configuration.NameValueSectionHandler&amp;quot; /&amp;gt;
        &amp;lt;/sectionGroup&amp;gt;
      &amp;lt;/configSections&amp;gt;
      &amp;lt;NUnit&amp;gt;
        &amp;lt;TestRunner&amp;gt;
           &amp;lt;!-- The ApartmentState value here is ignored. --&amp;gt;
           &amp;lt;add key=&amp;quot;ApartmentState&amp;quot; value=&amp;quot;STA&amp;quot; /&amp;gt;
        &amp;lt;/TestRunner&amp;gt;
      &amp;lt;/NUnit&amp;gt;
  &amp;lt;/configuration&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Instead you should use the &lt;a href="http://www.nunit.org/index.php?p=requiresSTA&amp;amp;r=2.6.1"&gt;RequiresSTA attribute&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;The RequiresSTA attribute can be used at the assembly, class or method level. To make NUnit to run all your unit tests with an STA thread you can add the following code to your AssemblyInfo.cs file in the project containing your unit tests.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;using NUnit.Framework;

[assembly: RequiresSTA]
&lt;/code&gt;&lt;/pre&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=43106" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/UnitTests/default.aspx">UnitTests</category></item><item><title>Code Coverage with OpenCover</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/08/08/CodeCoverageWithOpenCover.aspx</link><pubDate>Wed, 08 Aug 2012 20:49:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:43074</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=43074</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=43074</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/08/08/CodeCoverageWithOpenCover.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.3 now has integrated support for &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/opencover.aspx"&gt;OpenCover&lt;/a&gt; thanks to &lt;a href="http://www.lextm.com/"&gt;Lex Li&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;OpenCover is an open source &lt;a href="http://en.wikipedia.org/wiki/Code_coverage"&gt;code coverage tool&lt;/a&gt; created by &lt;a href="http://scubamunki.blogspot.co.uk/"&gt;Shaun Wilde&lt;/a&gt;. It can be used to measure how much of your code is covered by your unit tests. OpenCover was created to fix the following problems in &lt;a href="http://sourceforge.net/projects/partcover/"&gt;PartCover&lt;/a&gt;, another open source code coverage tool.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;64 bit support&lt;/li&gt;
&lt;li&gt;Memory usage&lt;/li&gt;
&lt;li&gt;Returning no coverage results&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For a more detailed look into why OpenCover was created you should read Shaun Wilde&amp;#39;s &lt;a href="http://scubamunki.blogspot.co.uk/2011/06/opencover-first-beta-release.html"&gt;OpenCover First Beta Release&lt;/a&gt; post.&lt;/p&gt;
&lt;p&gt;Back in 2006 SharpDevelop added support for NCover, then it switched to using PartCover a year later when NCover was turned into a commercial product. Now it supports and ships with OpenCover so let us take a tour of using OpenCover with SharpDevelop.&lt;/p&gt;
&lt;h2&gt;OpenCover Feature Tour&lt;/h2&gt;
&lt;p&gt;First you should install &lt;a href="http://build.sharpdevelop.net/buildartefacts/"&gt;SharpDevelop 4.3&lt;/a&gt;. Version 4.3.0.8911 or above will have OpenCover support. Then you will need to use a project with unit tests or alternatively you can &lt;a href="http://community.sharpdevelop.net/blogs/mattward/OpenCover/OpenCoverFeatureTour.zip"&gt;download a zip file&lt;/a&gt; which contains the set of projects created whilst writing this feature tour. Open your solution with SharpDevelop 4.3 and let us get started.&lt;/p&gt;
&lt;h2&gt;Running Unit Tests with Code Coverage&lt;/h2&gt;
&lt;p&gt;To run the unit tests with code coverage open the &lt;strong&gt;Unit Tests&lt;/strong&gt; window by selecting &lt;strong&gt;Tools&lt;/strong&gt; - &lt;strong&gt;Unit Tests&lt;/strong&gt; from the &lt;strong&gt;View&lt;/strong&gt; menu.  Right click the project or tests that you want to check for code coverage and select &lt;strong&gt;Run with code coverage&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourRunUnitTestsWithCodeCoverageUnitTestsWindowContextMenu.aspx" alt="Unit tests window Run with code coverage menu option" /&gt;&lt;/p&gt;
&lt;p&gt;At the top of the &lt;strong&gt;Unit Tests&lt;/strong&gt; window there is the run with code coverage toolbar button which can be also used to run code coverage for all the tests.&lt;/p&gt;
&lt;p&gt;Another way to run the unit tests with code coverage is to right click in the text editor and select the &lt;strong&gt;Run with code coverage&lt;/strong&gt; menu option.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourRunUnitTestsWithCodeCoverageTextEditorContextMenu.aspx" alt="Text editor Run with code coverage menu option" /&gt;&lt;/p&gt;
&lt;p&gt;The unit tests will then be run and OpenCover will profile your code. The output from OpenCover will be displayed in the &lt;strong&gt;Output&lt;/strong&gt; window. Once OpenCover is finished the code coverage results will be displayed in the &lt;strong&gt;Code Coverage&lt;/strong&gt; window.&lt;/p&gt;
&lt;h2&gt;Code Coverage Results&lt;/h2&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourCodeCoverageResultsWindow.aspx" alt="Code coverage results window" /&gt;&lt;/p&gt;
&lt;p&gt;The code coverage window will show you the percentage of code covered for each class, method and property. On the right hand side you can see the visit count information or if you select the &lt;strong&gt;Show Source Code&lt;/strong&gt; option you can see the corresponding source code with covered code highlighted in green and uncovered code highlighted in red.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourCodeCoverageResultsWindowShowSourceCode.aspx" alt="Code coverage results window show source code option" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourCodeCoverageResultsWindowWithSourceCode.aspx" alt="Code coverage results window with source code" /&gt;&lt;/p&gt;
&lt;p&gt;The Code Coverage window also allows you to enable or disable code coverage highlighting in the text editor. The top left button in the Code Coverage window is used to enable or disable code coverage highlighting in the text editor.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourCodeCoverageResultsWindowToggleCodeCoverageHighlighting.aspx" alt="Code coverage window - toggle code coverage highlighting" /&gt;&lt;/p&gt;
&lt;p&gt;In the screenshot below the text editor has covered code in highlighted in green and uncovered code in highlighted in red.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourTextEditorCodeCoverageHighlighting.aspx" alt="Code coverage highlighting in text editor" /&gt;&lt;/p&gt;
&lt;h2&gt;Filtering Code Coverage Results&lt;/h2&gt;
&lt;p&gt;By default OpenCover will show you code coverage for all your code including your tests. Typically you are not interested in code coverage for your unit tests. To exclude classes you can use a filter. The filters you can use are described on the &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/Usage.aspx"&gt;OpenCover wiki&lt;/a&gt;. To specify a filter in your unit tests project select &lt;strong&gt;Project Options&lt;/strong&gt; from the &lt;strong&gt;Project&lt;/strong&gt; menu.  Then open the &lt;strong&gt;Code Coverage&lt;/strong&gt; tab. Here you can specify an include or exclude filter. In the screenshot below all types in the &lt;strong&gt;OpenCoverageFeatureTour.Tests&lt;/strong&gt; assembly will be excluded.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourFilteringCodeCoverage.aspx" alt="Filtering code coverage results" /&gt;&lt;/p&gt;
&lt;h2&gt;64 bit or 32 bit&lt;/h2&gt;
&lt;p&gt;On Windows x64 if your test project is set to target a 32 bit processor then the 32 bit version of NUnit will be used to run your unit tests. If it is set to &lt;strong&gt;Any CPU&lt;/strong&gt; or a 64 bit processor then NUnit will run as a 64 bit process as OpenCover profiles your code.&lt;/p&gt;
&lt;h2&gt;Code Coverage Options&lt;/h2&gt;
&lt;p&gt;The colours used to highlight code coverage in the text editor and Code Coverage window can be configured in the Options dialog. From the &lt;strong&gt;Tools&lt;/strong&gt; menu select &lt;strong&gt;Options&lt;/strong&gt;. Then expand the &lt;strong&gt;Tools&lt;/strong&gt; category and select &lt;strong&gt;Code Coverage&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/OpenCoverFeatureTourCodeCoverageOptions.aspx" alt="Code coverage tools options dialog" /&gt;&lt;/p&gt;
&lt;p&gt;That ends the tour of using OpenCover with SharpDevelop.&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=43074" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/CodeCoverage/default.aspx">CodeCoverage</category></item><item><title>Using MSTest with SharpDevelop</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/05/06/UsingMSTestWithSharpDevelop.aspx</link><pubDate>Sun, 06 May 2012 17:32:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:40240</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=40240</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=40240</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/05/06/UsingMSTestWithSharpDevelop.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.2 now has a new 
    &lt;a href="http://wiki.sharpdevelop.net/InsideSharpDevelop.Samples-MSTestAddin.ashx"&gt;sample addin&lt;/a&gt; that adds integrated support for running tests 
    with 
    &lt;a href="http://http//msdn.microsoft.com/en-us/library/ms182489%28v=vs.100%29.aspx"&gt;MSTest&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Features&lt;/h2&gt;
&lt;p&gt;Given the following code:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/MSTestAddinTestClassSourceCode.aspx" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;In the &lt;b&gt;Unit Tests&lt;/b&gt; window the MS Tests will be displayed. 
    The unit tests can be run by right clicking and selecting &lt;b&gt;Run 
    tests&lt;/b&gt;. The &lt;b&gt;Unit Tests&lt;/b&gt; window will update to show the 
    tests that passed and failed.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/MSTestAddinUnitTestsWindowAfterTestRun.aspx" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The output from the MS test runner (mstest.exe) will be 
    displayed in the &lt;b&gt;Output&lt;/b&gt; window.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/MSTestAddinOutputWindow.aspx" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Any test failures are displayed in the &lt;b&gt;Errors&lt;/b&gt; window.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/MSTestAddinErrorsWindow.aspx" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;There is a default path defined for mstest.exe which points to 
    the Visual Studio 2010 folder but you can alter this path from the 
    Tools Options dialog under Tools - MS Test.&lt;/p&gt;
&lt;p&gt;Note that running tests with the debugger or with code coverage 
    does not work.&lt;/p&gt;
&lt;p&gt;Full details on how the addin works can be found in the 
    &lt;a href="http://wiki.sharpdevelop.net/InsideSharpDevelop.Samples-MSTestAddin.ashx"&gt;wiki&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Using the MSTest addin&lt;/h2&gt;
&lt;p&gt;To use the MSTest addin either follow the instructions in the 
    wiki to build it from source or download the 
    &lt;a href="http://community.sharpdevelop.net/blogs/mattward/MSTest/MSTest.zip"&gt;pre-built addin&lt;/a&gt; and register it with SharpDevelop using the 
    Addin Manager by selecting AddIn Manager from the Tools menu.&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=40240" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/MSTest/default.aspx">MSTest</category></item><item><title>Adding a Service Reference</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/04/22/AddServiceReference.aspx</link><pubDate>Sun, 22 Apr 2012 10:28:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:40117</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=40117</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=40117</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/04/22/AddServiceReference.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.2 now includes support for adding references to 
    WCF services.&lt;/p&gt;
&lt;h2&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=8279"&gt;Microsoft 
    Windows SDK&lt;/a&gt; should be installed.&lt;/p&gt;
&lt;p&gt;In order to generate the service reference SharpDevelop uses 
    Microsoft&amp;#39;s ServiceModel Metadata Utility Tool 
    &lt;a href="http://msdn.microsoft.com/en-us/library/aa347733.aspx"&gt;
    SvcUtil&lt;/a&gt; which is included as part of the 
    &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=8279"&gt;
    Microsoft Windows SDK&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Configuring SvcUtil Location&lt;/h2&gt;
&lt;p&gt;SharpDevelop should automatically detect where SvcUtil is 
    installed however the path to SvcUtil can be overridden if required 
    from the Tools - Options dialog. &lt;/p&gt;
&lt;p&gt;&lt;img alt="SvcUtil path configuration in Tools Options" src="http://community.sharpdevelop.net/photos/mattward/images/original/ToolsOptionsSvcUtilPathConfig.aspx" /&gt;&lt;/p&gt;
&lt;h2&gt;Adding a Service Reference&lt;/h2&gt;
&lt;p&gt;To add a service reference, open the Projects window, right 
    click on the project or the references and select Add Service 
    Reference.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Add service reference context menu" src="http://community.sharpdevelop.net/photos/mattward/images/original/AddServiceReferenceContextMenu.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;In the Add Service Reference dialog enter the url to the WCF 
    service and click Go. The WCF service that is discovered should 
    then be displayed.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Add service reference dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/AddServiceReferenceDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Clicking the Advanced button will allow you to configure further 
    generation options.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Advanced service reference options" src="http://community.sharpdevelop.net/photos/mattward/images/original/AdvancedServiceReferenceOptionsDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;In the main Add Service Reference dialog enter a namespace for 
    the service and then click the OK button to generate the service 
    reference.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Generated service reference in projects window." src="http://community.sharpdevelop.net/photos/mattward/images/original/GeneratedServiceReferenceInProjectsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;A service reference proxy will be added to the project and the 
    project&amp;#39;s app.config file will be updated with the WCF binding 
    information.&lt;/p&gt;
&lt;p&gt;Now you can use the WCF service in your application.&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=40117" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/WCF/default.aspx">WCF</category></item><item><title>JavaScript Code Folding</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/02/05/JavaScriptCodeFolding.aspx</link><pubDate>Sun, 05 Feb 2012 15:53:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:38454</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=38454</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=38454</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/02/05/JavaScriptCodeFolding.aspx#comments</comments><description>&lt;p&gt;SharpDevelop 4.2 now includes support for JavaScript code 
    folding and code regions.&lt;/p&gt;
&lt;p&gt;When you open a JavaScript (.js) file into the text editor any 
    functions that are defined can be folded.&lt;/p&gt;
&lt;p&gt;&lt;img alt="JavaScript code folding in text editor" src="http://community.sharpdevelop.net/photos/mattward/images/original/JavaScriptCodeFolding.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The text editor also supports code regions.&lt;/p&gt;
&lt;pre&gt;    //#region Canvas Test 
     
    tests[&amp;#39;canvas&amp;#39;] = function() { 
        var elem = document.createElement( &amp;#39;canvas&amp;#39; ); 
        return !!(elem.getContext &amp;amp;&amp;amp; elem.getContext(&amp;#39;2d&amp;#39;)); 
    }; 
     
    //#endregion&lt;/pre&gt;
&lt;p&gt;These regions can be folded as shown below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="JavaScript code regions folded in the text editor" src="http://community.sharpdevelop.net/photos/mattward/images/original/JavaScriptCodeRegionFolding.aspx" /&gt;&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=38454" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/JavaScript/default.aspx">JavaScript</category></item><item><title>ASP.NET MVC Support</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/01/29/AspNetMvcSupport.aspx</link><pubDate>Sun, 29 Jan 2012 20:56:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:38370</guid><dc:creator>MattWard</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=38370</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=38370</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/01/29/AspNetMvcSupport.aspx#comments</comments><description>&lt;p&gt;One of the new features in 
    &lt;a href="http://build.sharpdevelop.net/BuildArtefacts/"&gt;
    SharpDevelop 4.2&lt;/a&gt; is better support for ASP.NET MVC 3 
    applications. Previous versions contained project templates for 
    ASP.NET MVC but not much more. With SharpDevelop 4.2 the following 
    features have been added:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Razor project and file templates for C# and Visual Basic&lt;/li&gt;
&lt;li&gt;Razor syntax highlighting&lt;/li&gt;
&lt;li&gt;Add Controller dialog using T4 templates&lt;/li&gt;
&lt;li&gt;Add View dialog using T4 templates&lt;/li&gt;
&lt;li&gt;HTML folding&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now let us take at these new features.&lt;/p&gt;
&lt;h2&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;Before using SharpDevelop you should install ASP.NET MVC 3 and 
    IIS, either IIS Express or full IIS. You can get MVC 3 and IIS 
    Express from &lt;a href="http://www.microsoft.com/web/platform/"&gt;
    Microsoft&amp;#39;s Web Platform installer&lt;/a&gt; or download them 
    directly from the following pages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=208140"&gt;ASP.NET 
      MVC 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=1038"&gt;IIS 
      Express&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After installing IIS Express make sure that you run 
    IISExpress.exe once so it can generate its configuration files for 
    your user profile. If you do not then SharpDevelop will fail to 
    configure IIS Express.&lt;/p&gt;
&lt;h2&gt;Creating an ASP.NET MVC Application&lt;/h2&gt;
&lt;p&gt;Now we shall create a new C# ASP.NET MVC application that uses 
    the Razor view engine. First run SharpDevelop and then from the 
    &lt;b&gt;File&lt;/b&gt; menu select &lt;b&gt;New Solution&lt;/b&gt; to open the New Project 
    dialog.&lt;/p&gt;
&lt;p&gt;&lt;img alt="New ASP.NET MVC project dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/NewMvcProjectDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;On the left in &lt;b&gt;Categories&lt;/b&gt; select &lt;b&gt;ASP.NET MVC&lt;/b&gt; under 
    &lt;b&gt;C#&lt;/b&gt;. On the right you will see three project templates.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Empty MVC Application - creates an MVC application with a 
      minimal set of files.&lt;/li&gt;
&lt;li&gt;MVC Application - creates an MVC application that uses the 
      Web Forms view engine (.aspx).&lt;/li&gt;
&lt;li&gt;Razor MVC Application - creates an MVC application that uses 
      the Razor view engine.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Select the Razor MVC Application project template. Enter a name 
    for the project and select a location where the project will be 
    created. Click &lt;b&gt;Create&lt;/b&gt; to create the MVC project. &lt;/p&gt;
&lt;p&gt;&lt;img alt="ASP.NET MVC project in Projects window" src="http://community.sharpdevelop.net/photos/mattward/images/original/RazorMvcProjectInProjectsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;If you open the &lt;b&gt;Projects&lt;/b&gt; window by selecting 
    &lt;b&gt;Projects&lt;/b&gt; from the &lt;b&gt;View&lt;/b&gt; menu you will see that the 
    project template created a &lt;b&gt;Home Controller&lt;/b&gt;, two Razor view 
    pages - &lt;b&gt;Index&lt;/b&gt; and &lt;b&gt;Contact&lt;/b&gt;, as well as installing the 
    jQuery and Modernizer NuGet packages.&lt;/p&gt;
&lt;h2&gt;Syntax Highlighting and Folding&lt;/h2&gt;
&lt;p&gt;If you open the a Razor file (.cshtml) you will see that there 
    is html folding and Razor syntax highlighting.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Razor syntax highlighting" src="http://community.sharpdevelop.net/photos/mattward/images/original/RazorSyntaxHighlightingLayoutPage.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The Razor syntax highlighting is still under development and 
    does not work in all cases since it is not using Microsoft&amp;#39;s 
    Razor parser and uses a basic syntax definition file. In the 
    screenshot above, for example, the Razor @ symbol is not correctly 
    highlighted in the script and link tags.&lt;/p&gt;
&lt;h2&gt;Running an ASP.NET MVC Application&lt;/h2&gt;
&lt;p&gt;In order to be able to run your application first you will need 
    to configure the project to use IIS Express or IIS. From the 
    &lt;b&gt;Project&lt;/b&gt; menu select &lt;b&gt;Project Options&lt;/b&gt;. Select the 
    &lt;b&gt;Debug&lt;/b&gt; tab. At the bottom of this tab you will see options 
    for IIS Express and IIS.&lt;/p&gt;
&lt;p&gt;&lt;img alt="IIS project options" src="http://community.sharpdevelop.net/photos/mattward/images/original/IISProjectOptions.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;For this walkthrough we will use IIS Express. Select IIS Express 
    and enter a port number. Then click the &lt;b&gt;Create 
    Applicaton/Virtual Directory&lt;/b&gt; button. A message will then be 
    displayed telling you that the application/virtual directory was 
    created successfully. Now we can run the application.&lt;/p&gt;
&lt;p&gt;To run the application select &lt;b&gt;Run&lt;/b&gt; from the &lt;b&gt;Debug&lt;/b&gt; 
    menu. IIS Express will then be launched and your application will 
    be loaded into your default web browser.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ASP.NET MVC application running in browser" src="http://community.sharpdevelop.net/photos/mattward/images/original/AspMvcApplicationRunningInBrowser.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;You can set breakpoints in your application and debug your code 
    in the standard way. For example, set a breakpoint in the 
    HomeController&amp;#39;s Contact method and then click Contacts in 
    your browser and you will see SharpDevelop stop at the 
    breakpoint.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Breakpoint hit in HomeController Contact method" src="http://community.sharpdevelop.net/photos/mattward/images/original/BreakpointHitInHomeController.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;To stop debugging select &lt;b&gt;Stop process&lt;/b&gt; from the 
    &lt;b&gt;Debug&lt;/b&gt; menu. You will then see a prompt asking you to detach 
    or terminate the process being debugged, in this case IIS Express. 
    Detaching will leave IIS Express running.&lt;/p&gt;
&lt;h2&gt;File Templates&lt;/h2&gt;
&lt;p&gt;SharpDevelop includes a set of file templates for ASP.NET MVC 
    applications. You can create a new file using these templates by 
    selecting the project or a folder in the &lt;b&gt;Projects&lt;/b&gt; window, 
    right clicking and select &lt;b&gt;Add New Item&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ASP.NET MVC file templates in New File Dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/AspNetMvcFileTemplatesInNewFileDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Select the appropriate template, give the file a name and click 
    &lt;b&gt;Create&lt;/b&gt; to add a new file to your project.&lt;/p&gt;
&lt;h2&gt;Add Controller Dialog&lt;/h2&gt;
&lt;p&gt;You can add a new controller to your project using a file 
    template as described in the previous section or you can use the 
    &lt;b&gt;Add Controller dialog&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;Select the &lt;b&gt;Controllers&lt;/b&gt; folder in the &lt;b&gt;Projects&lt;/b&gt; 
    window, right click and select &lt;b&gt;Add Controller&lt;/b&gt; to show the 
    &lt;b&gt;Add Controller dialog&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Add controller dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/AddControllerDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;In the dialog you specify the controller&amp;#39;s name and select 
    one of the templates that will be used to generate the controller 
    class. These templates are defined by a single T4 template that you 
    can edit if you want to customise it. The T4 template exists in the 
    following subfolder where SharpDevelop was installed:&lt;/p&gt;
&lt;p&gt;AddIns\BackendBindings\AspNet.Mvc\ItemTemplates&lt;/p&gt;
&lt;p&gt;Click the &lt;b&gt;Add&lt;/b&gt; button to create a new controller from the 
    T4 template.&lt;/p&gt;
&lt;h2&gt;Add View Dialog&lt;/h2&gt;
&lt;p&gt;A new view can be created by using a file template or by using 
    the &lt;b&gt;Add View dialog&lt;/b&gt;. Select one of the &lt;b&gt;Views&lt;/b&gt; folders, 
    right click and select &lt;b&gt;Add New View&lt;/b&gt; to show the &lt;b&gt;Add View 
    dialog&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Add view dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/AddViewDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;In the dialog you can specify the following items:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;View Name&lt;/b&gt; - specifies the name of the view&lt;/li&gt;
&lt;li&gt;&lt;b&gt;View Engine&lt;/b&gt; - selects either web forms (ASPX) or Razor 
      view engine. The options displayed in the dialog will change 
      based on this selection.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Strongly Typed&lt;/b&gt; - allows you to generate a view based 
      on a type in your project.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Model&lt;/b&gt; - a list of types in your project. You may have 
      to compile your project for a class to be displayed in this drop 
      down.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt; - specifies which of the T4 templates will be 
      used when generating the view. Templates available are - Empty, 
      Create, Delete, Details, Edit, List.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Use Layout&lt;/b&gt; (Razor) - specifies whether the view will 
      use a layout.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Layout&lt;/b&gt; (Razor) - specifies the path to the layout 
      page. The browse button allows you to select a layout page from 
      those in your project.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;User Master Page&lt;/b&gt; (ASPX) - specifies whether the view 
      will use a master page.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Master Page&lt;/b&gt; (ASPX) - specifies the path to the master 
      page. The browse button allows you to select a master page from 
      those in your project.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Main Content ID&lt;/b&gt; (ASPX) - specifies the main content 
      ID.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Partial View&lt;/b&gt; - used to generate a partial view.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Views generated from this dialog use T4 templates which exist in 
    the following folder if you need to customise them:&lt;/p&gt;
&lt;p&gt;AddIns\BackendBindings\AspNet.Mvc\ItemTemplates&lt;/p&gt;
&lt;p&gt;That concludes the walkthrough of the new ASP.NET MVC 3 support 
    in SharpDevelop. Further information on ASP.NET MVC 3 can be found 
    at the &lt;a href="http://www.asp.net/mvc"&gt;Getting Started with 
    ASP.NET MVC&lt;/a&gt; page. &lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=38370" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/ASPNet/default.aspx">ASPNet</category><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/AspNetMvc/default.aspx">AspNetMvc</category></item><item><title>New Icons for SharpDevelop</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2012/01/21/NewIconsForSharpDevelop.aspx</link><pubDate>Sat, 21 Jan 2012 17:55:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:38273</guid><dc:creator>MattWard</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=38273</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=38273</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2012/01/21/NewIconsForSharpDevelop.aspx#comments</comments><description>&lt;p&gt;Thanks to &lt;a href="http://p.yusukekamiyamane.com/"&gt;Yusuke 
    Kamiyamane&amp;#39;s Fugue Icons&lt;/a&gt;, and icons created and remixed by 
    Michael Seeger, SharpDevelop 4.2 has a new look. A selection of 
    before and after screenshots are shown below:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;SharpDevelop 4.1 Toolbar&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Old toolbar" src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopToolbarOld.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;SharpDevelop 4.2 Toolbar&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="New toolbar" src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopToolbarNew.aspx" /&gt;&lt;/p&gt;
&lt;table class="none  " cellpadding="10"&gt;

&lt;tr&gt;
&lt;th&gt;SharpDevelop 4.1&lt;/th&gt;&lt;th&gt;SharpDevelop 4.2&lt;/th&gt;
&lt;/tr&gt;


&lt;tr&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopProjectsWindowOld.aspx" alt="" /&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopProjectsWindowNew.aspx" alt="" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopClassesWindowOld.aspx" alt="" /&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopClassesWindowNew.aspx" alt="" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopProjectIconsOld.aspx" alt="" /&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopProjectIconsNew.aspx" alt="" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopUnitTestsWindowOld.aspx" alt="" /&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="http://community.sharpdevelop.net/photos/mattward/images/original/SharpDevelopUnitTestsWindowNew.aspx" alt="" /&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=38273" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/Icons/default.aspx">Icons</category></item><item><title>Machine.Specifications (MSpec)</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2011/11/09/MachineSpecifications.aspx</link><pubDate>Wed, 09 Nov 2011 22:07:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:37615</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=37615</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=37615</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2011/11/09/MachineSpecifications.aspx#comments</comments><description>&lt;p&gt;Here is a preview of a new feature that is planned for 
    SharpDevelop - integrated support for Machine.Specifications.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/machine.aspx"&gt;Machine.Specifications&lt;/a&gt;, or MSpec for short, is a 
    &lt;a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development"&gt;
    Behaviour Driven Development&lt;/a&gt; framework for .NET created by 
    &lt;a href="http://codebetter.com/aaronjensen/2008/05/08/introducing-machine-specifications-or-mspec-for-short/"&gt;Aaron Jensen&lt;/a&gt; which takes its inspiration from 
    &lt;a href="http://code.google.com/p/specunit-net/"&gt;SpecUnit.NET&lt;/a&gt; 
    and &lt;a href="http://rspec.info/"&gt;RSpec&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Support for MSpec has been added thanks to 
    &lt;a href="http://blog.trecio.cba.pl"&gt;Tomasz Tretkowski&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So let us take a look at how the MSpec integration works in 
    SharpDevelop.&lt;/p&gt;
&lt;h2&gt;MSpec Integration&lt;/h2&gt;
&lt;p&gt;The first thing you will need to do is add a reference to MSpec 
    in the project that will contain your specifications. The easiest 
    way to do this is to use NuGet. Select your project, right click 
    and select &lt;b&gt;Manage Packages&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Manage Packages context menu" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecManagePackagesContextMenu.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Search for the &lt;b&gt;Machine.Specifications&lt;/b&gt; package and then 
    click the &lt;b&gt;Add&lt;/b&gt; button to add the NuGet package to your 
    project.&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec NuGet package selected in Manage Packages dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecPackageInManagePackagesDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;This will add a Machine.Specifications assembly reference to 
    your project.&lt;/p&gt;
&lt;p&gt;Now let us create our first specification. We are going to 
    create a specification which is based on an 
    &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/Machine.Specifications.aspx"&gt;example&lt;/a&gt; provided with the MSpec source code. The specification 
    is for transferring an amount of money between two bank accounts 
    and is shown below.&lt;/p&gt;
&lt;pre&gt;using System; 
using Machine.Specifications; 
 
namespace Banking.Tests 
{ 
    [Subject(typeof(Account), &amp;quot;Funds transfer&amp;quot;)] 
    public class when_transferring_between_two_accounts 
    { 
        static Account fromAccount; 
        static Account toAccount; 
         
        Establish context = () =&amp;gt; { 
            fromAccount = new Account { Balance = 1m }; 
            toAccount = new Account { Balance = 1m }; 
        }; 
         
        Because of = () =&amp;gt; 
            fromAccount.Transfer(1m, toAccount); 
         
        It should_debit_the_from_account_by_the_amount_transferred = () =&amp;gt; 
            fromAccount.Balance.ShouldEqual(0m); 
         
        It should_credit_the_to_account_by_the_amount_transferred = () =&amp;gt; 
            toAccount.Balance.ShouldEqual(2m); 
    } 
}&lt;/pre&gt;
&lt;p&gt;MSpec uses &lt;b&gt;Establish&lt;/b&gt;/&lt;b&gt;Because&lt;/b&gt;/&lt;b&gt;It&lt;/b&gt; which is 
    equivalent to &lt;b&gt;Given&lt;/b&gt;/&lt;b&gt;When&lt;/b&gt;/&lt;b&gt;Then&lt;/b&gt; that is used 
    with SpecFlow. &lt;b&gt;Establish&lt;/b&gt; is used to setup the initial state. 
    &lt;b&gt;Because&lt;/b&gt; is used to define the event/action that you are 
    testing. &lt;b&gt;It&lt;/b&gt; is used to test the final state and see if it 
    matches what is expected.&lt;/p&gt;
&lt;p&gt;The Account class that is used by this specification is shown 
    below.&lt;/p&gt;
&lt;pre&gt;using System; 
 
namespace Banking 
{ 
    public class Account 
    { 
        public decimal Balance { get; set; } 
        
        public void Transfer(decimal amount, Account toAccount) 
        {             
        }
    } 
}&lt;/pre&gt;
&lt;p&gt;Specifications are displayed in the &lt;b&gt;Unit Tests&lt;/b&gt; window. 
    This window can be opened by selecting &lt;b&gt;Unit Tests&lt;/b&gt; from the 
    &lt;b&gt;View&lt;/b&gt; | &lt;b&gt;Tools&lt;/b&gt; menu. The specification we have defined 
    will be displayed in the Unit Test window as shown below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec tests in Unit Tests window" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecTestsInUnitTestsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The Unit Tests window will update as the specification is 
    written in the same way it does when you are writing NUnit 
    tests.&lt;/p&gt;
&lt;p&gt;To run MSpec you can right click a specification and select 
    &lt;b&gt;Run tests&lt;/b&gt; or you can click the toolbar buttons at the top of 
    the Unit Tests window.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Run tests context menu in Unit Tests window" src="http://community.sharpdevelop.net/photos/mattward/images/original/RunMSpecTestsInUnitTestsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Failures will be highlighted in Red in the Unit Tests window.&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec failures in Unit Tests window" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecFailuresInUnitTestsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The output from MSpec is displayed in the &lt;b&gt;Output&lt;/b&gt; 
    window.&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec runner output in Output window" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecOutputInOutputWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Failures are also added to the &lt;b&gt;Errors&lt;/b&gt; window. Clicking on 
    an error will take you directly to the source code for the failing 
    test.&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec failures in Errors window" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecFailuresInOutputWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Now we have to fix the failures by implementing the 
    Account&amp;#39;s Transfer method. The updated Transfer method is 
    shown below:&lt;/p&gt;
&lt;pre&gt;public void Transfer(decimal amount, Account toAccount) 
{ 
    Balance -= amount; 
    toAccount.Balance += amount; 
}&lt;/pre&gt;
&lt;p&gt;After making this change and running MSpec again everything 
    passes, as shown below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec passes shown in green in Unit Tests window" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecPassesInUnitTestsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec success output in Output Window" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecPassedTestsOutputInOutputWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;That completes the quick introduction to using MSpec with 
    SharpDevelop. Now let us take a look at MSpec Behaviours.&lt;/p&gt;
&lt;h2&gt;MSpec Behaviours&lt;/h2&gt;
&lt;p&gt;MSpec Behaviours are a way to group together a set of tests that 
    you want to re-use with different contexts. To do this you create a 
    separate class, add a Behaviors attribute to it, and move your 
    tests into that class. This behaviour class is then referenced by 
    using the  &lt;b&gt;Behaves_like&lt;/b&gt; syntax. An example taken from the 
    &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/Machine.Specifications.Example.aspx"&gt;MSpec examples&lt;/a&gt; is shown below.&lt;/p&gt;
&lt;pre&gt;using System; 
using Machine.Specifications; 
 
namespace Banking.Tests 
{ 
    [Subject(&amp;quot;Date time parsing&amp;quot;)] 
    public class when_a_date_is_parsed_with_the_regular_expression_parser 
     : DateTimeParsingSpecs 
    { 
        Establish context = () =&amp;gt;  
         Parser = new RegexParser(); 
 
        Because of = () =&amp;gt;  
         ParsedDate = Parser.Parse(&amp;quot;2009/01/21&amp;quot;); 
 
        Behaves_like&amp;lt;DateTimeParsingBehavior&amp;gt; a_date_time_parser; 
    } 
 
    [Subject(&amp;quot;Date time parsing&amp;quot;)] 
    public class when_a_date_is_parsed_by_the_infrastructure 
     : DateTimeParsingSpecs 
    { 
        Establish context = () =&amp;gt;  
         Parser = new InfrastructureParser(); 
 
        Because of = () =&amp;gt;  
         ParsedDate = Parser.Parse(&amp;quot;2009/01/21&amp;quot;); 
 
        Behaves_like&amp;lt;DateTimeParsingBehavior&amp;gt; a_date_time_parser; 
    } 
 
    public abstract class DateTimeParsingSpecs 
    { 
        protected static DateTime ParsedDate; 
        protected static IParser Parser; 
    } 
 
    [Behaviors] 
    public class DateTimeParsingBehavior 
    { 
        protected static DateTime ParsedDate; 
 
        It should_parse_the_expected_date = () =&amp;gt;  
            ParsedDate.ShouldEqual(new DateTime(2009, 1, 21)); 
    } 
}&lt;/pre&gt;
&lt;p&gt;Here the behaviour of the parser returning a particular date has 
    been extracted and re-used across two different contexts.&lt;/p&gt;
&lt;p&gt;SharpDevelop is aware of MSpec behaviours and will display the 
    underlying tests. The date time parser specifications above will be 
    displayed in the Unit Tests window as shown below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="MSpec behaviours in Unit Tests window" src="http://community.sharpdevelop.net/photos/mattward/images/original/MSpecBehavioursInUnitTestsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;For further details on MSpec behaviours take a look at the 
    &lt;a href="http://lostechies.com/jamesgregory/2010/01/18/behaviours-in-mspec/"&gt;Behaviours in MSpec&lt;/a&gt; post by James Gregory.&lt;/p&gt;
&lt;h2&gt;Further MSpec Information&lt;/h2&gt;
&lt;p&gt;Here is a selection of links to further information on MSpec 
    that you may find useful.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/machine.aspx"&gt;MSpec on Github&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/aaronjensen/2008/05/08/introducing-machine-specifications-or-mspec-for-short/"&gt;Introducing MSpec&lt;/a&gt; - Aaron Jensen&amp;#39;s post that first 
    introduced MSpec.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://elegantcode.com/2010/02/19/getting-started-with-machine-specifications-mspec/"&gt;Getting Started with MSpec&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://wekeroad.com/mvc-storefront/kona-3/"&gt;Learning 
    BDD&lt;/a&gt; - If you prefer to learn by watching a video check out Rob 
    Conery&amp;#39;s BDD screencast where he discusses BDD and also covers 
    MSpec.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://wekeroad.com/blog/make-bdd-your-bff-2/"&gt;Make BDD 
    your BFF&lt;/a&gt; - Rob Conery walks through BDD with MSpec.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.awkwardcoder.com/index.php/2010/10/11/teaching-a-string-calculator-how-to-behave/"&gt;Teaching a String Calculator How to Behave&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://lostechies.com/jamesgregory/2010/01/18/behaviours-in-mspec/"&gt;Behaviours in MSpec&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=37615" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/MSpec/default.aspx">MSpec</category></item><item><title>SubSonic T4 Templates</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2011/10/05/SubsonicT4Templates.aspx</link><pubDate>Wed, 05 Oct 2011 20:33:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:37301</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=37301</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=37301</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2011/10/05/SubsonicT4Templates.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://build.sharpdevelop.net/BuildArtefacts/"&gt;SharpDevelop 4.2&lt;/a&gt; now supports SubSonic T4 templates. 
    &lt;a href="http://subsonicproject.com/"&gt;Subsonic&lt;/a&gt; is an open 
    source 
    &lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping"&gt;
    object-relational mapper&lt;/a&gt; and makes use of T4 templates in all 
    but one of its supported methods to provide access to your data. 
    Before we take a look at what new T4 features were added to 
    SharpDevelop to support SubSonic let us see what you need to do to 
    get everything working.&lt;/p&gt;
&lt;h2&gt;Using SubSonic T4 Templates with SharpDevelop&lt;/h2&gt;
&lt;p&gt;In order to use the SubSonic T4 templates with SharpDevelop you 
    need to make two modifications to the Settings.ttinclude file.&lt;/p&gt;
&lt;p&gt;Replace the EnvDTE assembly reference:&lt;/p&gt;
&lt;pre&gt;&amp;lt;#@ assembly name=&amp;quot;EnvDTE&amp;quot; #&amp;gt;&lt;/pre&gt;
&lt;p&gt;With the following:&lt;/p&gt;
&lt;pre&gt;&amp;lt;#@ assembly name=&amp;quot;$(addinpath:ICSharpCode.PackageManagement)PackageManagement.dll&amp;quot; #&amp;gt;&lt;/pre&gt;
&lt;p&gt;This references SharpDevelop&amp;#39;s NuGet addin assembly which 
    implements its own version of the Visual Studio object model.&lt;/p&gt;
&lt;p&gt;In SharpDevelop 4.3 an extra assembly directive is needed, as shown below:&lt;/p&gt;
&lt;pre&gt;&amp;lt;#@ assembly name=&amp;quot;SharpDevelop.EnvDTE.dll&amp;quot; #&amp;gt;&lt;/pre&gt;
&lt;p&gt;Add a new import directive as shown below:&lt;/p&gt;
&lt;pre&gt;&amp;lt;#@ import namespace=&amp;quot;EnvDTE = ICSharpCode.PackageManagement.EnvDTE&amp;quot; #&amp;gt;&lt;/pre&gt;
&lt;p&gt;This creates a namespace alias for EnvDTE so the references to 
    the Visual Studio object model in the SubSonic T4 template will 
    work.&lt;/p&gt;
&lt;p&gt;In SharpDevelop 4.3 the EnvDTE import directive does not need to be changed.&lt;/p&gt;
&lt;p&gt;All that is left now is to save the changes made to the 
    Settings.ttinclude file and generate the database access code by 
    executing the ActiveRecord.tt, Context.tt and Struct.tt T4 
    templates. This can be done by right clicking them in the Projects 
    window and selecting Execute Custom Tool.&lt;/p&gt;
&lt;p&gt;Now we will take a look at the new features that made this 
    possible.&lt;/p&gt;
&lt;h2&gt;Referencing SharpDevelop Properties and Environment Variables 
    in T4 Templates&lt;/h2&gt;
&lt;p&gt;The T4 assembly and include directives now support the 
    $(PropertyName) syntax to use SharpDevelop properties such as 
    SolutionDir and ProjectDir.&lt;/p&gt;
&lt;pre&gt;&amp;lt;#@ assembly name=&amp;quot;$(ProjectDir)lib\MyLibrary.dll&amp;quot; #&amp;gt; 
&amp;lt;#@ include file=&amp;quot;$(SolutionDir)Templates\MyTextTemplate.tt&amp;quot; #&amp;gt; &lt;/pre&gt;
&lt;p&gt;The assembly and include directives also support environment 
    variables through the %EnvironmentVariableName% syntax.&lt;/p&gt;
&lt;pre&gt;&amp;lt;#@ assembly name=&amp;quot;%ProgramFiles%\lib\MyLibrary.dll&amp;quot; #&amp;gt; 
&amp;lt;#@ include file=&amp;quot;%HOMEPATH%\MyTextTemplate.tt&amp;quot; #&amp;gt;&lt;/pre&gt;
&lt;p&gt;This new feature also supports the addinpath property and is 
    used to allow a T4 template to reference SharpDevelop&amp;#39;s NuGet 
    addin using the $(addinpath:AddIn-ID) syntax which is expanded to 
    the directory containing the addin.&lt;/p&gt;
&lt;h2&gt;Accessing the SharpDevelop IDE from a T4 Template&lt;/h2&gt;
&lt;p&gt;The SubSonic T4 templates use the Visual Studio object model to 
    find the project&amp;#39;s app.config file and read the database 
    connection string stored here in order to access your database. To 
    support this the T4 templating host in SharpDevelop now implements 
    the IServiceProvider interface which allows you to access 
    SharpDevelop&amp;#39;s implementation of the Visual Studio object 
    model.&lt;/p&gt;
&lt;p&gt;To access the Visual Studio object model you set the T4 template 
    so it is host specific:&lt;/p&gt;
&lt;pre&gt;&amp;lt;#@ template language=&amp;quot;C#&amp;quot; hostspecific=&amp;quot;true&amp;quot; #&amp;gt;&lt;/pre&gt;
&lt;p&gt;Then you can access the DTE object, which is the top-level 
    object of the Visual Studio object model, as shown below.&lt;/p&gt;
&lt;pre&gt;&amp;lt;#
    IServiceProvider provider = (IServiceProvider)Host; 
    EnvDTE.DTE dte = (EnvDTE.DTE)provider.GetService(typeof(EnvDTE.DTE));
#&amp;gt;&lt;/pre&gt;
&lt;p&gt;The Visual Studio object model is not fully implemented in 
    SharpDevelop so you may run into problems if you make extensive use 
    of this object model.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[Update 2012-10-11]&lt;/strong&gt; Added changes required for SharpDevelop 4.3&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=37301" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/T4/default.aspx">T4</category></item><item><title>SpecFlow Integration</title><link>http://community.sharpdevelop.net/blogs/mattward/archive/2011/08/09/SpecFlowIntegration.aspx</link><pubDate>Tue, 09 Aug 2011 19:23:00 GMT</pubDate><guid isPermaLink="false">1b90d1c1-04e6-45b0-b51d-b665527d49b9:36651</guid><dc:creator>MattWard</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/rsscomments.aspx?PostID=36651</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.sharpdevelop.net/blogs/mattward/commentapi.aspx?PostID=36651</wfw:comment><comments>http://community.sharpdevelop.net/blogs/mattward/archive/2011/08/09/SpecFlowIntegration.aspx#comments</comments><description>&lt;p&gt;The &lt;a href="http://specflow.org/"&gt;SpecFlow&lt;/a&gt; team recently 
    released version 1.7 and with it they included 
    &lt;a href="http://gasparnagy.blogspot.com/2011/08/enhanced-upgrading-options-in-specflow.html"&gt;support for SharpDevelop 4.0&lt;/a&gt;. SpecFlow is an open source 
    framework that you can use to do 
    &lt;a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development"&gt;
    Behaviour Driven Development (BDD)&lt;/a&gt; on .NET. It allows you to 
    bind business requirements to the code. Let us take a look at how 
    SpecFlow integrates with SharpDevelop.&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;Download and install the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://sourceforge.net/projects/sharpdevelop/files/SharpDevelop%204.x/4.0/SharpDevelop_4.0.0.7070_Setup.msi/download"&gt;SharpDevelop 4.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/downloads.aspx"&gt;SpecFlow 1.7.0&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If SharpDevelop is installed first then the SpecFlow installer 
    will  detect SharpDevelop, as shown in the screenshot below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="SpecFlow installer detecting SharpDevelop 4.0" src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecflowSetupDialogDetectedSharpDevelop4.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The installer will then add a set of SpecFlow templates to 
    SharpDevelop. It will also install a SharpDevelop addin which you 
    will need to register using the addin manager. To register the 
    SpecFlow addin start SharpDevelop and from the Tools menu select 
    AddIn Manager. This will open the AddIn Manager dialog.&lt;/p&gt;
&lt;p&gt;&lt;img alt="AddIn Manager dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/AddInManagerDialogInSharpDevelop4.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Click the Install AddIn button and browse to the SpecFlow 
    installation folder. The default installation folder for SpecFlow 
    is &lt;b&gt;C:\Program Files\TechTalk\SpecFlow&lt;/b&gt;. In this folder find 
    the &lt;b&gt;TechTalk.SpecFlow.SharpDevelop4Integration.addin&lt;/b&gt; file, 
    select it and click the Open button. The SpecFlow addin should then 
    be displayed in the AddIn Manager dialog.&lt;/p&gt;
&lt;p&gt;&lt;img alt="SpecFlow addin installed in SharpDevelop 4.0" src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecFlowAddInInstalledInSharpDevelop4.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Restart SharpDevelop so the SpecFlow addin is loaded and is 
    ready to be used.&lt;/p&gt;
&lt;p&gt;Now let us take a look at how to use SpecFlow with 
    SharpDevelop.&lt;/p&gt;
&lt;h2&gt;Using SpecFlow&lt;/h2&gt;
&lt;p&gt;Here we will follow the 
    &lt;a href="http://specflow.org/specflow/workflow.aspx"&gt;workflow&lt;/a&gt; 
    that is shown on the SpecFlow web site. This workflow looks at 
    creating a bowling game using SpecFlow.&lt;/p&gt;
&lt;p&gt;In SharpDevelop create a new C# class library project called 
    Bowling. Right click the project just created and select Add New 
    Item. In the New File dialog open the &lt;b&gt;SpecFlow&lt;/b&gt; category and 
    select the &lt;b&gt;SpecFlow Feature&lt;/b&gt; template. Change the filename to 
    be ScoreCalculation.feature. Click the Create button to save the 
    file.&lt;/p&gt;
&lt;p&gt;&lt;img alt="SpecFlow feature file template in New File Dialog" src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecFlowFeatureFileTemplateInNewFileDialog.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Replace the existing text in the feature file created with the 
    text shown below.&lt;/p&gt;
&lt;pre&gt;Feature: Score Calculation 
 In order to know my performance 
 As a player 
 I want the system to calculate my total score 
 
Scenario: Gutter Game 
 Given a new bowling game 
 When all of my balls are landing in the gutter 
 Then my total score should be 0 
 
Scenario: All Strikes 
 Given a new bowling game 
 When all of my rolls are strikes 
 Then my total score should be 300&lt;/pre&gt;
&lt;p&gt;This is the specification for one part of the game. It is 
    written in a language called 
    &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/Gherkin.aspx"&gt;
    Gherkin&lt;/a&gt; which gives you a user friendly way to specify a set of 
    behaviours that your application should have. More information 
    about the Gherkin language can be found on the 
    &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/Gherkin.aspx"&gt;Gherkin 
    wiki&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now select this feature file in the Projects window, right click 
    and select Properties. In the file properties change the Custom 
    Tool to be &lt;b&gt;SpecFlowSingleFileGenerator&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="SpecFlowSingleFileGenerator custom tool set in file properties" src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecFlowSingleFileGeneratorCustomToolSetInFileProperties.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Now every time you save the feature file a new file will be 
    auto-generated.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ScoreCalculation.feature.cs generated file." src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecFlowSingleFileGeneratorCustomToolGeneratedFileInProjectsWindow.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;If you open this generated file you will see that it contains a 
    class that has two NUnit tests.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Generated file with NUnit tests." src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecFlowSingleFileGeneratorCustomToolGeneratedFileContents.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;To run the unit tests you will need to add a reference to NUnit 
    and SpecFlow to the project. In the Projects window, right click 
    your project and select Add Reference. Select the .NET Assembly 
    Browser tab and browse to the NUnit.Framework.dll file that can be 
    found in the SharpDevelop folder C:\Program 
    Files\SharpDevelop\4.0\bin\Tools\NUnit and add that file as a 
    reference. Do the same for the TechTalk.SpecFlow.dll file which can 
    be found in the C:\Program Files\TechTalk\SpecFlow folder.&lt;/p&gt;
&lt;p&gt;Now create a new file called BowlingSteps.cs and copy the 
    following code into it.&lt;/p&gt;
&lt;pre&gt;using System; 
using NUnit.Framework; 
using TechTalk.SpecFlow; 
 
namespace Bowling 
{ 
 
 [Binding] 
 public class BowlingSteps 
 { 
  private Game _game; 
 
  [Given(@&amp;quot;a new bowling game&amp;quot;)] 
  public void GivenANewBowlingGame() 
  { 
   _game = new Game(); 
  } 
 
  [When(@&amp;quot;all of my balls are landing in the gutter&amp;quot;)] 
  public void WhenAllOfMyBallsAreLandingInTheGutter() 
  { 
   for (int i = 0; i &amp;lt; 20; i++) 
   { 
    _game.Roll(0); 
   } 
  } 
 
  [When(@&amp;quot;all of my rolls are strikes&amp;quot;)] 
  public void WhenAllOfMyRollsAreStrikes() 
  { 
   for (int i = 0; i &amp;lt; 12; i++) 
   { 
    _game.Roll(10); 
   } 
  } 
 
  [Then(@&amp;quot;my total score should be (\d+)&amp;quot;)] 
  public void ThenMyTotalScoreShouldBe(int score) 
  { 
   Assert.AreEqual(score, _game.Score); 
  } 
 
  [When(@&amp;quot;I roll (\d+)&amp;quot;)] 
  public void WhenIRoll(int pins) 
  { 
   _game.Roll(pins); 
  } 
 
  [When(@&amp;quot;I roll (\d+) and (\d+)&amp;quot;)] 
  public void WhenIRoll(int pins1, int pins2) 
  { 
   _game.Roll(pins1); 
   _game.Roll(pins2); 
  }  
 
  [When(@&amp;quot;I roll (\d+) times (\d+) and (\d+)&amp;quot;)] 
  public void WhenIRollSeveralTimes2(int rollCount, int pins1, int pins2) 
  { 
   for (int i = 0; i &amp;lt; rollCount; i++) 
   { 
    _game.Roll(pins1); 
    _game.Roll(pins2); 
   } 
  } 
 
  [When(@&amp;quot;I roll the following series:(.*)&amp;quot;)] 
  public void WhenIRollTheFollowingSeries(string series) 
  { 
   foreach (var roll in series.Trim().Split(&amp;#39;,&amp;#39;)) 
   { 
    _game.Roll(int.Parse(roll)); 
   } 
  } 
 
  [When(@&amp;quot;I roll&amp;quot;)] 
  public void WhenIRoll(Table rolls) 
  { 
   foreach (var row in rolls.Rows) 
   { 
    _game.Roll(int.Parse(row[&amp;quot;Pins&amp;quot;])); 
   } 
  } 
 } 
}&lt;/pre&gt;
&lt;p&gt;The BowlingSteps.cs file shown above implements the scenarios 
    defined in the feature file and will be used by the unit tests to 
    verify the implementation works as expected.&lt;/p&gt;
&lt;p&gt;The only bit that is missing is the code that implements the 
    bowling game logic. Create a file called Game.cs and copy the code 
    shown into it.&lt;/p&gt;
&lt;pre&gt;namespace Bowling 
{ 
 public class Game 
 { 
  public void Roll(int i) 
  {     
  } 
   
  public int Score {  
   get { return -1; } 
  } 
 } 
} 
&lt;/pre&gt;
&lt;p&gt;The Game.cs file contains the main Game class that implements 
    the logic that we are going to test. Currently this code is 
    incorrect so we are expecting the unit tests to fail.&lt;/p&gt;
&lt;p&gt;In the Unit Tests window (View | Tools | Unit Tests) click the 
    Run all tests toolbar button. All the tests should fail as shown 
    below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="All specflow unit tests failed." src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecFlowUnitTestsAllFailed.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;Now we need to fix the tests. The GutterGame test is the easiest 
    to get working. Edit the Game class and change the Score property 
    so it returns 0.&lt;/p&gt;
&lt;pre&gt;namespace Bowling 
{ 
 public class Game 
 { 
  public void Roll(int i) 
  { 
  } 
   
  public int Score {  
   get { return 0; } 
  } 
 } 
}&lt;/pre&gt;
&lt;p&gt;Now when you run the unit tests again the GutterGame test will 
    pass.&lt;/p&gt;
&lt;p&gt;&lt;img alt="SpecFlow gutter game unit test passes" src="http://community.sharpdevelop.net/photos/mattward/images/original/SpecFlowUnitTestsGutterGameTestPassed.aspx" /&gt;&lt;/p&gt;
&lt;p&gt;The next step would be to change the Game class so the 
    AllStrikes unit test will pass. Then you could define more 
    scenarios in feature files to cover more functionality that you 
    want the bowling game to have. Then you would go through the 
    process just described until you have a working solution that meets 
    all the requirements. These steps are not shown here but hopefully 
    you get the idea.&lt;/p&gt;
&lt;p&gt;We have looked at how SpecFlow integrates with SharpDevelop and 
    walked through the process of defining a set of scenarios that our 
    application should have, creating unit tests to check the scenarios 
    are implemented correctly and finally implementing the application 
    logic so the unit tests pass.&lt;/p&gt;
&lt;h2&gt;Further Information&lt;/h2&gt;
&lt;p&gt;More information on SpecFlow can be found on the 
    &lt;a href="http://www.specflow.org/specflow/getting-started.aspx"&gt;
    SpecFlow web site&lt;/a&gt; and on the 
    &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/wiki.aspx"&gt;SpecFlow GitHub 
    wiki&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://community.sharpdevelop.net/aggbug.aspx?PostID=36651" width="1" height="1"&gt;</description><category domain="http://community.sharpdevelop.net/blogs/mattward/archive/tags/SpecFlow/default.aspx">SpecFlow</category></item></channel></rss>