This blog is subject the DISCLAIMER below.

Monday, January 17, 2011

How to solve "Silverlight.CSharp.targets was not found" problem


Friend of mine asked that she can't build any Silverlight project inside VS 2010 from http://gallery.expression.microsoft.com.
The error was similar to : 
C:\OverlappingTabs.csproj : error  : Unable to read the project file 'OverlappingTabs.csproj'.
C:\OverlappingTabs.csproj(108,3): The imported project "C:\Program Files\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

This problem runs because VS2010 came up with support for Silverlight 3 but not Silverlight 4 as Silverlight 4 had released after VS2010.

What you need is just setup "Microsoft Silverlight 4 Tools for Visual Studio 2010" about 35 MB without restarting your OS.



.. more.

Sunday, January 09, 2011

How to force undo checkout? #TFS

Sometimes you'd pop into cases where you find yourself in a situation where you have to force undo pending code changes of someone else (say a colleague who is no more around, or even temporarily) or your own pending changes if say your machine (along with your workspace on it).

Well, there a Visual Studio tool for that.. That's tf command-line utility, which you can look for in your VS directory under Common7\IDE..

Using tf has lots and lots of uses, here's a really LONG list of them. Note: there's 3 sub-lists for VS2005, 2008, 2010. But for our tiny problem here, we mainly have to options, I'm using here the most straight forward ones:

Undoing pending changes for a specific file:

That will need mainly main parameters to start with: The name/path of the file checkout, User name (of the user who did the checkout), and the Workspace in which the checkout was done (usually your machine name if you didn't create an new workspace).

You could have an issue with the third one (workspace name), so you might have to check the Workspaces command for more details, but generally a small command like the one below will do just ok in most cases:

tf workspaces /owner:UserName

Knowing the above you can easily undo the pending changes as below, note: parameters are in squiggly braces like {these}:

tf undo {file path} /workspace:{workspace};{username} /server:{TFS name/IP}

Of course the "/server" part can be removed if you're on the same server running TFS. An example with some data will look like:

tf undo $/myProject/myFile.cs /workspace:mySpace;FCIH\shady /server:FCIH_TFS

Deleting the whole workspace:

The other option is to delete the whole workspace, which in turn delete any related checkouts. A simple command for that could be:

tf workspace /delete {workspace};{username} /server:{TFS name/IP}

which with some example parameters might look like:

tf workspace /delete Shady-PC;FCIH\shady /server:10.0.0.2

UPDATE:

After a comment by Meligy, I think I needed to add this: Most of the above needs you to be logged in as an account with TFS admin privileges, check the exact required permissions for Undo, Workspace and Workspaces commands.

If you're not logged in as the appropriate account, you can append {/login:username, [password]} to provide the authorized username and password.

Meligy, also, mentioned another tool called TFS Sidekicks that can do similar stuff.

.. more.

Thursday, January 06, 2011

Silverlight: Image Carousel(3d Album)

Here is my "HelloWorld" Sliverlight application as in below picture for carousel by Sliverlight with source code as GNU GENERAL PUBLIC LICENSE.


The original code is here by Shine Draw then modified and enhanced by me.
The following are new features which I have added:
  1. Added Slider bar to view all items by scrolling.
  2. Linked the (Slider) with mouse wheel.
  3. Added a subject label related to every selected Item. 
  4. Added the ablilty to move next by selecting an arbitrary item (mouse click to the corresponding item only).
  5. Added a projection effect to every non-selected items.
  6. Added control panel to setup metadata on running time. 
     
Here is the source code with comments.
All what you need is Visual Studio 2008 or 2010 and Silverlight 3 or more (click here to get Sliverlight).
Note: 
No need to setup Microsoft Expression Blend, all effects are mathematics behind.

.. more.