02 Apr 2009

How to convert a VS standard class library to a Workflow activity library

Introduction

image VS. image

If you are working in a workflow foundation project you may find you have created a class library (see image below) and want to put workflow activities into it but you may have issues with that because you didn’t create a Workflow activity library.

Issues

Some of the issues you may find are the add item menu doesn’t have the options you expect and the workflow designer interface doesn’t work.

image VS. image

Solution

To solve this you need to modify the class library project file very slightly. To do that simply open the file with a text editor such as Notepad or use the options in Visual Studio to unload and edit the project.

image

The first thing is to add a ProjectTypeGuids node to the base PropertyGroup node. To get there you need to navigate to the PropertyGroup node (it is under the Project node) without any Condition attributes. On my machine that is on line 3

image

Next add the following line in the node:

<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Example: image

Next you need add a new project target into the Project node. You should already have one of these  around line 56

image

Right below that you need to add a new one (so you will have two), the line to add is:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />

Example: image

Now save the project file and re-open it in Visual Studio and the problems should be gone!

Troubleshooting

You may find that the designer is not working or you get errors when adding new activities still. In such a case it could be that you are missing the workflow foundation assemblies (System.Workflow.Activities; System.Workflow.ComponentModel; System.Workflow.Runtime):

image

Once you have those added everything should be working fine.

26 Mar 2009

Boring Games Are Dead

figurebannerblog

Microsoft is running a competition for the most fun game to play and the winner gets a free trip to Tech-Ed 2009! Since it is Microsoft games need to be developed using XNA Game Studio, Visual Studio or Expression Studio and must run on Windows!

Since it is decided on by the community there is also a prize for one of the ‘judges’!

More information can be found at: www.boringgamesaredead.co.za

25 Mar 2009

What makes a senior developer

Trumpi asked the question What makes a senior developer? So I started to write a comment on it, and it ended up a little big for a comment so I thought a blog post would be better.

Warning: This post is FULL of generalizations and is based on my narrow sighted view of the world.

Before I answer the title question, I want to take a stab at a point in Trumpi’s post about why they are tossing so many 'senior' dev's CVs away? Arne commented on it and said it’s because developers want the high life quicker (easier?) now. I disagree with Arne because I think it's the companies who hire these junior/intermediate developers and push them into higher positions out of need (i.e. the company does not have seniors, so they put intermediates or juniors into those positions as there is a gap to fill). They then think because they are a senior in company x - they should be a senior else where. I’ve seen this a lot in the “newer” development companies, the more established ones seem to avoid this issue.

Not to say that I haven’t met developers wanting the high life quickly - however this seems to stem from a education background. Developers who are self trained, go to training colleges or techs don’t seem to be so fast lane driven. The higher the education (honor students being the worst) seem that the “high life quickly” syndrome effects them more.

To the question at hand what makes a senior developer? That is a tough question because it's more about environment/culture of the company than the person him/her self. If your culture is more formal (suit and tie), senior could be based more on qualification while in a more informal environment it could be more experience. There is no wrong or right here.

My view of a senior is a person who meets 5 key items: Knowledge, Proven, Sharing, Passionate, and Humility.

  • Knowledge: Has a deep knowledge of a technology or technologies (how it was obtained is irrelevant to me).
  • Proven: Has paid his 'school fees': Meaning he has done real (hard) work to prove he deserves to be called senior.
  • Sharing: Is able to share knowledge. This is important because a senior who can't share knowledge is not worth it. Now there is the issue about personality here (being that some developers don’t really have one) - I am not saying seniors need to be the great speakers like Scott Hanselman, or sales men. If they are introverted and can only share with people they know at work, that is just as good as being a great speaker/blogger etc…
  • Passionate: They must be passionate. As a senior, being called a geek/nerd is a badge of honor that should be strived for.
  • Humility: Lastly, and most importantly, the culmination of all of those points should lead a senior to actually be in the spot of saying I don't know everything... but I am willing to learn.

The senior developers I have worked with have come from such a varied background and are on many a varied path but they all meet those 5 points.

17 Mar 2009

Free SharePoint Posters

What could look better than a great poster on SharePoint development up on your wall? How about if it was free? Well the S.A. Architect community has a number of posters in crazy high resolutions (they all seem to  be around 33mega pixels or 6872 x 4916 for the more technical ones out there). So what posters are available and where do you get them?

Well you can get them and hundreds more from: S.A. Architect Posters, and the posters are:

Creating SharePoint Web Applications

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20Creating%20Web%20Applications.jpg

Developing with SharePoint 2007 - Concepts

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20DevelopingWithSharepoint2007.jpg

SharePoint Concepts

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20Sharepoint%20Concepts.jpg

SharePoint Development Environment Scenarios

Great one for planning how your development team will work against SharePoint!

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20SharePoint%20Development%20Scenarios.jpg

SharePoint Architecture For Developers

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20SharepointArchitecture.jpg

SharePoint Workflow Development Lifecycle

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20SharepointWorkflow.jpg

SharePoint Site Structure

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20SiteStructure.jpg

SharePoint HTTP Request Pipeline

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20TheRequestPipeline.jpg

SharePoint HTTP Request Pipeline - Ghosting & unghosting

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20TheRequestPipelineGhostingAndUnghosting.jpg

SharePoint Workflow Basics

image

Direct Link: http://www.saarchitect.net/Publications/Value%20Add%20Information/Quick%20Reference%20Posters/BBD%20Technology%20Readiness/JPG%20(high-quality%20A4-A2%20scalability)/0500%20WFBasics.jpg

16 Mar 2009

ADO.NET Data Services - Weird Error

Working on a project which uses ADO.NET data services for a small part of it. I put the ADO.NET Data Services portion together (add the files, put the EF data model together, link it up etc…) on my machine (Windows 2008 Server, SQL 2008, VS 2008) and it all worked great! Checked into source control and then went about doing something else, ignorant of the coming problem.

Then the developer who would actually consume it (we are consuming it in C# using LINQ) came to me saying that nothing worked :( All we get is the generic ADO.NET Data Services error: “An error occurred while processing this request”. We removed the where clauses and everything worked perfectly, which hinted to me the LINQ/EF expression tree was borking out somewhere. So we went to the EF data model, told it to update and it did a change under the surface and everything worked again?!

image

I love TFS because it allowed me to compare my version and the updated one easily and their was one tiny change (literally 1 byte!) in the edmx file (not the .cs backing file, the edmx file itself). Turns out that in dev they are using SQL Server 2005 and I built the model with SQL Server 2008 - now note there is ZERO 2008 special features in use, but it seems that the EF expression tree doesn’t care and try’s to use some SQL 2008 magic cause it thinks it is SQL 2008. This is controlled by the ProviderManifestToken attribute! Changing that to 2005 (which is what the update did automatically for me) solved the problem!

image

23 Feb 2009

SharePoint Developer Tools: Feb CTP Release of VSeWSS 1.3

There is a new release of the VSeWSS (what a crap name) CTP 1.3. What are these? These are the tools you need to actually work with SharePoint from Visual Studio to create the advanced workflows or web parts etc… It also includes the documentation that is invaluable for working with any part of SharePoint from Visual Studio. What’s new in the Feb ‘09 release:

New Features in VSeWSS 1.3
  • The extensions now install on x64 bit OS. Visual Studio 2008 and SharePoint must be already installed.
  • Command Line Build option for TFS and MSBuild integration
  • Separate WSP Package and Retract commands. You can now build the WSP without deploying it
  • SPSolGen to Support Exporting from Content Management Publishing Sites
  • New Item Template for RootFiles Deployment
  • Automatically Remove conflicting existing features on development SharePoint server
  • WSP View New Feature Dialog Improvements: scope, receiver checkbox, element checkbox
  • WSP View can now be used to merge features and it blocks site features being merged into web features
  • Allow adding separate binary files such as Workflow assemblies
  • Some refactoring allowing for Web Part renaming and removing lines from feature.xml Item Removed
  • Allow selection of GAC or BIN deployment for Web Part Project not including CAS generation
  • Increase visibility of hidden features that VSeWSS creates
  • Add fast update deploy for DLL only or file only changes to solutions
  • Numerous Bug Fixes and improvements to error messages

You can download it on the Connect site.

Thanks to zainnab for the heads up.

05 Feb 2009

Workflow Foundation Activity Template

WF has two two types of activities you can create, the easy one and the hard one. That’s not really their names (though it would be cool), the first (easy) is a composite activity. This is is the one that Visual Studio lets you create and is in effect just another sequential workflow which you build up and reuse.

image

However when you use them they just look like sequence activities. If you want something that looks like a “real” (read: what you get out of the box) activity to need to create the hard one which is call an activity (so clear a name, ain’t it). The smallest this can be is one class and the biggest it can be is five classes and they all basically have the same structure. So it’s weird that there is no easy way to build these, say a template. Well I have created one which sets up the base for an activity and lets you get going as quickly as possible.

Usage

To use it, select the normal Add -> New Project, and under Visual C#, My Templates will be the template called WF Activity! Some things that should become clear from that little sentence

  • You need Visual Studio 2008 (yeah, that wasn’t clear but I need to sneak it in somewhere).
  • It’s C# only
  • It creates a project for your new activity for ease of packaging purposes.
  • And for some reason if I put a space in the name, if crashes my Visual Studio - so um, that could just be me.

 

image

When you create it, it creates 4 files which all start with the name you choose (that will also be the name for your activity, so I don’t suggest putting activity in it) - For example mine was called ConsoleWriteLine so my files are:

  • ConsoleWriteLineActivity.cs
  • ConsoleWriteLineActivityDesigner.cs
  • ConsoleWriteLineActivityDesignerTheme.cs
  • ConsoleWriteLineActivityValidator.cs

image 

Special Features

I will come back to what they do but I thought I would point out that I have taken special care with the code so that if you run code analysis (fxcop) you get no issues with the code - you will get five for the project not being signed and com visibility stuff - and that StyleCop also reports no issues. I have also added in three TODO’s (if you use the VS task list)

image

  • The first one (Write Code) takes you to the Execute method in the {Project}Activity.cs file. This is what will run when your activity is executed.
  • The second one (Pick some nice colours) takes you to {Project}ActivityDesignerTheme.cs file where you can specify the start and end colours for the gradient. By default it’s dark to light blue.

image

  • The third one (Add validation) takes you to the Validate method in the {Project}ActivityValidator.cs file where you can add any design time validation you need. It even has a sample of how to add a validation failure message.

image

What do I need to add to use it?

Basically all you need to do to get up and running is

1) Add the properties you need to the {Project}Activity.cs file.

2) Add the code as indicated by the task item.

3) Compile and use.

Optionally you can change the colours, add validation, add an icon or change what is shown on the component. The changing of what is shown is controlled via the SetText method in {Project}ActivityDesigner.cs and it has been wired up so that it will respond to property changes. So you can actually have the text change if the properties change with very little code needed.

How do I deploy it?

To use it just dump the ZIP file in the Visual Studio 2008 > Templates> ProjectTemplates > Visual C# in your documents folder and restart Visual Studio!

image

Where can I get it?

 

Note: My hosting provider has something that corrupts zip files so it has been uploaded in 7-zip format which you will need to extract it.

Hopefully you get some productivity benefit from this component or it helps you learn how to write your own, and if it does please leave a comment here so I know (and get that warn fuzzy feeling I like so much).

29 Jan 2009

Dublin - What you need to know!

Dublin is the code name for a application server which will ship as a separate download for Windows server around the .NET 4.0 timeframe. The application server’s focus will be on Workflow Foundation and Windows Communication Foundation applications. So, to me the developer pushing out code today what does it mean?

Well it means that a lot of the grunt work involved with WCF/WF applications is taken away because Dublin will provide a host for them - no more need for IIS for WCF and bespoke solutions for WF. That is not so great, I mean of course you can write your own still and in some situations that will be faster or more scalable than Dublin, but because the host is built the surrounding services come included. So lets take a prime example of how this would effect WF: Currently WF has a great tracking system which you can visualize using WinForms or ASP.NET, but why should I need to “copy-and-paste” that code into every WF application? Why isn’t there an out of the box tool like BizTalk has? Well since the Dublin server will host your workflows they will now provide you with a tool to do it!

Dublin setup/configuration tool

There is some important points to understand here:

  • Dublin is NOT .NET Framework 4 - It’s a separate Windows Server component. Updates will follow the Framework update schedule, but that’s as close as it gets.
  • Dublin is backwards compatible to .NET Framework 3.5 - So the work you are doing today is not wasted.
  • Dublin will support Oslo - Dublin is the first application to support administrators deploying out of Oslo.
  • So do I need BizTalk - Yes. BizTalk will still be great for B2B or LOB integration scenarios where you still will need to write code to get close to those great out of the box features. It is told they will work well together, but I have no details on how yet.
  • So do I need IIS - Yes. Even though a lot of apps now run on IIS will be moved to Dublin, you still want IIS for what it it good for - websites. In addition to that Dublin’s management interface is part of IIS!

Dublin settings in IIS 7.0

  • OS supported - Nothing official I can find but it uses IIS 7.0 so that implies Windows 2008 is a requirement.
  • What will it be called - Nothing offical although the beta bits have Windows Application Server as the name so it looks like it could be that.

Interesting the first customers to start work on Dublin are the Dynamics AX and CRM teams. Since I know CRM let me explain how I think they will use it (nothing official here). In MSCRM 4.0 you have two core components (high level):

  • Async Service - Which runs workflows
  • Web site - Which does the front end and web services

The async service will be dropped and it’s function together with hosting of the web services will be shifted over to Dublin with IIS continuing to host the website!

Persistence Out of the Box!

You can find out more at http://www.microsoft.com/NET/Dublin.aspx

Pictures from: http://www.biztalkgurus.com/blogs/biztalk/archive/2008/11/02/first-look-screen-shots-of-windows-application-server-dublin.aspx

Pages