Unable to cast object from type 'x' to type 'x'

29 ביוני 2008

Here is a problem I encountered while working with Visual Studio 2005 and 2008.... The last time this happened to me was while working on TFS custom control. So in order to create a custom control, we must add the assembly we have created and a wicc file to the following folder: "C:\Documents and Settings\All Users\Application Data\Microsoft\Team Foundation\Work Item Tracking\Custom Controls\9.0" This is the path where TFS (Team Explorer) will look at when using custom controls. When I deployed a new version of the custom control to that location I suddenly started receiving the InvalidCastException telling me that...
3 תגובות

Convert .ResX file to .Resource file

16 ביוני 2008

Here is a small utility that will help you convert a *.ResX file to *.Resource file:void GenerateResources(string source, string target) { ResXResourceReader reader = new ResXResourceReader(source); IDictionaryEnumerator iterator = reader.GetEnumerator(); // Define a resource writer for writing resource files IResourceWriter writer = new ResourceWriter(target); while (iterator.MoveNext()) { writer.AddResource(iterator.Key.ToString().PadRight(10, ' '), iterator.Value); } writer.Generate(); reader.Close(); writer.Close(); } Where the source is the ResX file name...
תגיות: ,
תגובה אחת

Design Decision: Using CAB

11 ביוני 2008

I have a customer that wants to built a client application, the application should support composition, add-ins type development (each developer or team to concentrate on their area of expertise), smart parts UI controls and several other typical client requirements. Being Microsoft oriented person, I considered using the CAB (composite application block). I had to make a design decision whether I will go that road or not. CAB The Composite UI Application Block facilitates the design and implementation of your client applications in three areas: It allows your application to be based on the concept of modules or plug-ins. It...
תגיות: ,
4 תגובות

Reusing types in WCF

8 ביוני 2008

For those of you who ever wrote a web service (I guess most of you have), sharing types was an impossible mission. If you had defined a type in the server side (the web service side), when consuming it on the client side, the proxy generated for you contained the same type but under a different namespace. Do you know that problem?! When WCF shipped, a new possibilities emerged. One can now share types and reuse them. In order to do so, all you need to do is get into the "Configure Service Reference.."   Now verify that the "Reuse types in...
תגיות: ,
6 תגובות

Project & Namespaces

5 ביוני 2008

When it comes to creating a .NET project, whether this is a class library, windows application or any other project type, you must give it a name. If we will look at the project options we will see that the name we gave applies to both the assembly name and the default namespace. For example if I created a project by the name of Core, the result will be as follows: Now, for each item that I will add to the project under the root will get the default namespace, for example if I add a new...
תגיות: ,
אין תגובות