23 August, 2010

WPF: Where is the Main method? Or how to overwrite the Main method?

If you want to be able to control in details the startup of your WPF application, you will be needing access to the Main method. This can be the case if you want to make sure that only a single instance is running on the entire PC (by using Mutexes). But, where on Earth is the Main method to control the application startup?

Well – Microsoft has been so “kind” as to hide this method from us! It is located in obj/debug in app.g.cs (‘g’ short for generated). As it is generated, it makes little sense to edit this file as it will be overwritten on next build. So what to do? Here is how:

1) Select your project’s current startup file (app.xaml)
2) Set BuildAction = Page
3) Add a file as below (MyApplication.cs)
Note: Do not call this file Application.cs and the class Application. It will conflict with the inner workings of WPF

You now have complete control of the Main method and the application startup.

public class MyApplication
public static void Main(string[] args)
App app = new App();

11 August, 2010

TFS 2010: How to force comments when doing check-in?

For the life of me, I had really problems figuring out how to force comments from the developers when they do a checkin in TFS 2010. As I recall from TFS 2005, it was quite easy to setup, but that was not the case in TFS 2010!

Googling the matter also lead to a lot of desperate guys trying to solve the same problem. Well – finally I managed to locate the setting:

checkin0  checkin


How to do:
1) Find “Team Project Settings”
2) “Source Control…”
3) Enter Check-in Policy tab
4) Add…
5) Select “Changeset Comments Policy”
6) OK

You are done!

Technorati Tags: ,

InRiver: Not loading your extensions?

(You really need to in the loop to appreciate the issue this post addresses). Man, I've been fighting this problem for hours before I ...