.NET Profiles in .NET 4 and VS 2010


As I have mentioned earlier in my last blog post, .NET 3.5 SP1 first had the concept called Profiles. In .NET 3.5 SP1 it was possible to build an app for Client Profile. The idea is to create subset of the whole .NET Framework, which is very big for easier install, maintenance and less memory footprint. Since Client Apps really need a subset of whole .NET Framework, .NET 3.5 Client Profile contains only client specific libraries like ASP.NET, WPF, CLR and WinForms. Libraries like ASP.NET or LINQ were not included as they are not required for Client Apps.

Now in .NET 4, there is one more profile available – called Server Core Profile. Server Core Profile is a subset of the .NET framework for server applications. It can run server oriented applications like ASP.NET and WCF.

 

As you can guess, Server Core profile does not contain Client UI specific libraries like WPF and WinForms. So if you create a WPF or WinForms app and change the Target Framework (in Project properties dialog) to .NET Framework 3.5 Server Profile, certain dlls (from WPF or WinForms) would be missing and you would get an error while compiling the app.

 

 

Now as you can see, there isn’t a Server profile available for .NET Framework 4 in Beta 2. You can expect to see that when .NET 4 (and VS 2010) is finally released by Microsoft this year.

Aniruddha

.NET Framework Client Profile – new in .NET 3.5 SP1


.NET Framework 3.5 SP1 (Service Pack 1) comes with a new deployment feature called “.NET Framework Client Profile”. It provides a new setup installer that enables a smaller (27 MB), faster and simpler installation experience for .NET client applications on machines that do not already have the .NET Framework installed. It’s a subset of assemblies already contained within .NET Framework 3.5 Service Pack 1.

Client Profile contains the parts of .NET Framework that is typically used in .NET client apps –

  • Common Language Runtime (CLR)
  • ClickOnce
  • Windows Forms
  • Windows Presentation Foundation (WPF)
  • Windows Communication Foundation (WCF)

To show how Client Profile works let’s create a WPF client app (you can also create a Win Forms app). Open the project property window and navigate to Application tab.

Check the “Client-only Framework subset” checkbox  as shown below – (by default it’s unchecked).

 

That’s all that you need to do to use “Cleint Profile”. Once this is checked, app.config file is added in the project. Open the app.config file and you would find the following entry –

<?xml version="1.0"?>

<configuration>

  <startup>

    <supportedRuntime version="v2.0.50727" sku="Client"/>

  </startup>

</configuration>

The supportedRuntime element specifies which versions of the common language runtime the application supports. At runtime, the framework runtime will check the contents of the file, if the sku="Client" declaration is not found, the runtime will assume that this application requires the full .NET Framework and prompt the end-user to install the full .NET Framework.

Now to test how Visual Studio behaves if a .NET dll/asssmebly that’s not part of Client Profile is referenced in the project, we will add a server only .NET assembly.

So we added System.Data.Linq as project reference (System.Data.Linq contains classes of LINQ to SQL). Once the dll reference is added, build the project. You would notice two thing –

The dll just added (System.Data.Linq) is shown with missing reference (exclamation icon).

A warning mentioning System.Data.Linq is not part of Client Framework subset is shown by Visual Studio.

 

So for using Client Profile or Client Framework subset you should use only the dlls that are part of client framework subset.

Here’re few good links –

TFS Build Notification in TFS Power Tool


One of the questions about TFS (Team Foundation Server) Build that I have received many times is how to configure TFS Build so that it sends build notification for a specific or set of specific builds. In any big project, normally there would be many team builds configured – there would be CI builds, there would be daily/nightly builds and there would be builds per branch or area of project.

You can configure TFS settings, so that TFS sends you email when a build finishes or build quality changes. To configure Build Notification, right click on the Team Project for which you want to configure build notification in Team Explorer (in Visual Studio) and select Project Alerts menu.

 

In the Project Alerts dialog select the events for which you want to be notifies. Apart from Team Build, you can also get notification on Work Items and Source Control check in. Enter the email address and Email Format (Plat Text or HTML). Once you click on ‘OK’ you are done. Team Foundation would send you notification for the events that you have selected.

 

While this gives an easy option for notification registration, this does not allow you to choose the builds for which you want to get notification. Team Foundation would send you email alert about all the builds for the Team Project.

If you want to get notifies about only specific builds, you have to use Team Foundation Server Power Tool Build Notification. Build Notification runs as a service in Service Tray and notifies you about the builds that you have registered against.

 

To choose the builds, right click on Team Foundation Build Notification on the Service Tray and select Options.

Team Foundation Build Notification uses the settings from Visual Studio, connects to TFS Server and shows all the Team Projects for which you have permission in Configure Build Notification dialog –

 

Expand the Team Project and select the builds for which you want to be notified. You can select whether you want to be informed when the build is queued, started or finished. You can also select whether you want notification for builds queued by all or builds queued by yourself.

 

It shows a desktop notification when the events for which you have registered occurs (like build started, build finished). The notification pop up allows you to postpone or cancel a build.

 

You can also select View Build Status menu option and check the status of the build.

So if you have not used Team Build Notification Power Tool yet, download the Power Tool and start using it right away. It’s Free!

Aniruddha