Wednesday, February 22, 2012

Is WPF purely case-sensitive?

What do you think about case sensitivity of WPF?
At first glance, your answer might be YES, it is case-sensitive. But if this has to be true then how come width="auto" & width="Auto" both works fine? On the other hand if is case-insensitive then why do controls don't accept 'width' as its property? You can define the width of a control only using 'Width' (Capital W).

Well the answer is it is partly case-sensitive.

From the MSDN:
XAML is generally speaking case sensitive. For purposes of resolving backing types, WPF XAML is case sensitive by the same rules that the CLR is case sensitive. Object elements, property elements, and attribute names must all be specified by using the sensitive casing when compared by name to the underlying type in the assembly, or to a member of a type. XAML language keywords and primitives are also case sensitive. Values are not always case sensitive. Case sensitivity for values will depend on the type converter behavior associated with the property that takes the value, or the property value type. For example, properties that take the Boolean type can take either true or True as equivalent values, but only because the native WPF XAML parser type conversion for string to Boolean already permits these as equivalents.
 
Excerpt: Instead of saying WPF is case-sensitive, we can say that XAML IS case-sensitive but the property values are not always case dependent. It depends on property value converter. That's why both 'Auto' and 'auto' works, although in some special cases the property converter might not be able to handle them with case-insensitivity. In other words, you can say that property names are case-sensitive; however, property values might not be case-sensitive.

Sources: MSDN, Stackoverflow.

Monday, February 13, 2012

Solution Platforms and Configurations


UPDATE: Earlier this blog post was big and have my inputs too but majorly the intent was from visual studio hacks link. Now I've removed that and suggest you to go directly to this link http://visualstudiohacks.com/articles/visual-studio-net-platform-target-explained/. They have explained it very nicely.

Team Build deals with solution configurations - these are the platforms (e.g. .NET or Win32) and configurations (e.g. Debug or Release) you typically see in combo boxes within Visual Studio when you have a solution loaded (if you hover over these boxes the tooltips will say "Solution Platforms" and "Solution Configurations", respectively).




Thursday, February 9, 2012

Reset Visual Studio to default settings

Use "devenv /resetsettings" command to reset your Visual Studio settings to default one as it comes when you install a fresh copy of VS.

Thursday, February 2, 2012

Migrating a shelveset from one branch to another

Are you working on an application development which follows code branching strategy in order to deliver timely product releases? If yes, then you might need to merge a shelveset from one branch to another. Here are the simple steps to do the same.

Prerequisites:
1. Visual Studio 2010
2. Team Foundation Server power tools 2011. Link To Download

Steps to follow:
TFS Power Tools provides the ability to migrate a shelveset, but with the limitation that you can use this feature only through command line.
1. Quick link to open Visual Studio command prompt is press Windows key and type "Command" in search box.




2. "tfpt unshelve" is the command provided by power tools for code migration and that's all you need to know. To get a brief overview about the command type "tfpt unshelve /?" in command prompt.


Quite simple, you just have to use the command as mentioned in usage. However, you need to take care of the source and target branch path. 

3. Simple Rule:
I'm assuming that both source and target branch are under the same folder say "Gulliver" here and branch hierarchy is "Gulliver/Code-branch-1", "Gulliver/Code-branch-2". You have created a shelveset in code-branch-1 and want to migrate it to code-branch-2. Also, your solution lies in Code-branch-1, Code-branch-2 folder.

Change your command prompt directory from default one to the both branch common folder, Gulliver here. Thereafter your command to migrate will be:

tfpt unshelve "<shelveset name>";<developername> /migrate /source:"<source branch solution path>" /target:"<target branch solution path>"

e.g. : tfpt unshelve "demo_shelveset";rkandhal /migrate /source:"$/Code-branch-1" /target:"$Code-branch-2/"


Note: Few imp points worth noting,
1. In above command $ in source/target path represents the root directory of your TFS repository. So take care of both paths considering their hierarchy in tfs.
2. You may receive an error entitled: "Unhandled exception has occured in a component in your application. The path 'adbcadsfasdf' contains the character ';'. Remove the ';' and try again." This issue happens because of wrong target  branch path. Provide the target branch path somewhat similar to "$/branch-2/"  - no colon in the end.



Thats it, you are done. On command execution, if your code is password protected, then you will be prompted for TFS password then Unshelve dialog will open and you're required to select the shelveset which you want to merge. There after auto-merge dialog prompts up and in case you have not provide the correct target branch path, resolution will results to an error otherwise your code changes will be merged to target branch. Here is the snapshot of command output:



Notice that for each file there is a result status in command window.