Debug Dataset error

I got this error:

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

With the debug tricks from PaulStock, that helps!

References: http://stackoverflow.com/questions/7026566/failed-to-enable-constraints-one-or-more-rows-contain-values-violating-non-null

 

The project file {0} has been moved, renamed or is not on your computer

I face similar issue described in this post:

The project file * has been moved, renamed or is not on your computer

I am using VS2010. I have one project not recognize in solution (Unloaded and grey out), when edit the .sln file notices there are unmatched entries:

SccProjectUniqueName102 = CorrectPath\\Modules\\MyProject.csproj

SccProjectName102 = WrongPath/MyProject
SccLocalPath102 = WrongPath\\MyProject

Most of the answers on the internet tell you to delete the .suo file so you will get rid of it, I have tried but no luck, end up I decides to correct the paths manually in .sln file, like this:

Step 1/2

SccProjectUniqueName102 = CorrectPath\\Modules\\MyPorject.csproj

SccProjectName102 = CorrectPath/Modules/MyProject
SccLocalPath102 = CorrectPath\\Modules\\MyProject

Save the changes and open the solution again, Visual Studio still prompt me a warning said the ‘MyProject’ failed to load.

Step 2/2
Ok, it seems I should try the most popular solution, delete .suo …

Open solution again, and ….. No error/warning message given!

Pheeew, solved it at last.

Reminder:

You will lose your Visual Studio user settings by deleting the .suo file, like breakpoints, opened tabs, expanded/collapsed tree nodes, etc.

Keywords: .suo, .sln, Visual Studio 2010 Solution, Setting

References:

  1. The project file * has been moved, renamed or is not on your computer
  2. Hack the Project and Solution Files

Prism RegionContext become NULL when View Removed from Region

Found a bug in Prism Region Context last month and Prism team has quick fix for this that work flawless!

Thread posted: Region context set to NULL when remove any view in region

Solution : Prism v4: RegionContext lost when removing a view from a region

You can find the sample project in my thread, looks for the name “Prism_RegionContext”, and below shows the key part captured, read the comments:

Search keywords : Prism v4.0, context, region, Communicating between components, MVVM

Reformat/Re-align code in Visual Studio

Found a useful tip when I looking for StyleCop essay.

How to: Reformat your code in Visual Studio

In brief, do these:

  1. Select the code you want to re-format (CTRL + A if want to re-format whole file).
  2. Press CTRL + K
  3. Press CTRL + F
  4. Done.

 

If work in VB.Net, it will auto set TitleCase and align the code, however in C#, it only re-align the code, but this is the feature I like the most since C# code never align for you again if the alignment was out.

 

Reference: How to: Reformat your code in Visual Studio

Keyword: Alignment, align, code style

Commond Prompt for Visual Studio .Net

If you install Visual Studio 2005, you would not face this problem, because the commond prompt and other tools already appear in your classical Windows Start Menu.

However if you install Visual Studio Express Edition, you would not get any shortcuts for those tools, let say you need the command prompt which support Visual Studio .Net, you need to type “cmd” in ‘Run’ dialog, and change the directory to .NetFramework folder.

Unfortunately I using Express edition in office, therefore I need to work around to get the ‘Visual Studio Command Prompt’. After compare with ‘real’ Visual Studio command prompt, below is my work around, the key is:

  1. Call a new console screen from batch file.
  2. Attach necessary path for .Net in new console screen, so you do not need to change to .Net directory when u need the command in .Net.

Please refer to your own .Net Framework version when doing this, example below is just for .Net version 2.0 .

Steps:

  1. Create an empty batch file, insert line in # 2 into batch file, DO include double quote.
  2. cmd /K “path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727&&cls”
  3. Place the batch file in appropriate directory, create a shortcut for the batch file.
  4. Select Properties of the shortcut, change ‘Start in:‘ from current directory to ‘C:\(arbitrary directory)’
  5. Now double click the shortcut, Windows prompt up a clean cmd console screen which support .Net Framework command (since already setup in PATH).

 

Explaination for step # 2:

  • Command string after /K will be carry out and apply to new console process.
  • the ‘&&’ is the separator for seperated commands in same line, the line above consists two commands, first is append the path, second is clear the screen after append path.

 

Explanation for steps # 3 and # 4:

  • There are two ways to set the PROMPT in console window, the first way already show in steps 3 & 4, so you just put any startup directory you like in step 4.
  • The second way, you need to amend step 2 a bit, change it to below:

cmd /K “path=%path%;C:\WINDOWS\Microsoft.NET\Framework\

v2.0.50727&&PROMPT=C:\Windows$G&&cls”

Ya, it is just add in another command for new console screen (Set the PROMPT=C:\Windows$G).

 

Keyword: Visual Studio Console Window, Tool, Tools, IDE, Command prompt