Using MSBuild with Smart Client Software Factories

The Smart Client Software Factory (SCSF) is an awesome tool. It comes in the form as a guidance package from the patterns and practices guys and kicks off your initial Smart Client app with various services, several projects, and a shell application all built on top of the Composite Application UI Block (CAB).

I have found one problem with the current version of SCSF and that's when you generate the initial solution and try to build it using MSBuild. Create a solution using the factory and try building the .sln file with MSBuild. You'll get a host of errors about projects referencing projects that don't exist. Here's some sample output:

SmartClientSolution1.sln : Solution file warning MSB4051: Project {90BC9A2E-DF32-4D50-AB7A-2967B8F5D8D9} is referencing a project with GUID {BE39A9ED-D4C6-42E7-91D6-63D9B1D185C6}, but a project with this GUID was not found in the .SLN file.

I believe this might be because the .csproj/.sln file is generated before the GUIDs are. It doesn't have a problem in the IDE because it references projects by relative file path, but when you try to build a solution using MSBuild (like via an automated build server) the build fails.

Just to clarify this. The GUIDs in the solution file and csproj files are correct however where each project references another in the csproj file it contains both a reference location and a GUID. It's that GUID that's incorrect.

Here's the section in each .csproj I'm referring to:

<ItemGroup>
<ProjectReference Include="..\Infrastructure.Interface\Infrastructure.Interface.csproj">
<Project>{C0143C3B-2D43-4CC3-B593-236D4097F23F}</Project>
<Name>Infrastructure.Interface</Name>
</ProjectReference>
<ProjectReference Include="..\Infrastructure.Library\Infrastructure.Library.csproj">
<Project>{90BC9A2E-DF32-4D50-AB7A-2967B8F5D8D9}</Project>
<Name>Infrastructure.Library</Name>
</ProjectReference>
</ItemGroup>

You can fix this without a problem. To do so just open up the .csproj file and in the ItemGroup section, paste in the correct GUIDs for each project it's referring to from the original .sln file. The references that need to be fixed are:

  • Infrastructure.Library referencing Infrastructure.Interface
  • Infrastructure.Module referencing Infrastructure.Interface
  • Shell referencing Infrastructure.Interface
  • Shell referencing Infrastructure.Library

Once you've updated the GUIDs in the .csproj files, you'll be good to go for automated builds of your CAB projects. I've logged this as an issue here on the new CodePlex site so hopefully they'll get to fixing this as it was a real pain to find.

1 Comment

Comments have been disabled for this content.