Category Archives: Useful tips

Entity Framework – Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.

This is how Visual Studio tells you that something went wrong while updating your entity.
Simple solution would be to catch System.Data.Entity.Validation.DbEntityValidationException and iterate through EntityValidationErrors collection.

	return _context.SaveChanges();
catch (System.Data.Entity.Validation.DbEntityValidationException dbvEx)
    List<string> errors = new List<string>();
    foreach (var validationErrors in dbvEx.EntityValidationErrors)
        foreach (var validationError in validationErrors.ValidationErrors)
            errors.Add(string.Format("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage));
    return 0;


This database file is not compatible with the current instance of SQL Server

This error occurred to me in Visual Studio 2013 while create connection to local AdventureWorks 2012 mdf file.

This database file is not compatible with the current instance of SQL Server. To resolve this issue, you must upgrade the database file by creating a new data connection, or you must modify the existing connection to this database file. For more information, see

In order to upgrade the database, just follow steps described under the link above:

To upgrade a database file to use LocalDB

  1. In Server Explorer, choose the Connect to Database button.
  2. In the Add Connection dialog box, specify the following information:
    • Data Source: Microsoft SQL Server (SqlClient)
    • Server Name: (LocalDB)\v11.0
    • Attach a database file: Path, where Path is the physical path of the primary .mdf file.
    • Logical Name: Name, where Name is the name that you want to use with the file
  3. Choose the OK button.
  4. When prompted, choose the Yes button to upgrade the file

The database is upgraded, attached to the LocalDB database engine, and no longer compatible with SQL Server 2008 Express.

Visual Studio 2013 – project builds but reports The type or namespace name could not be found

Full error:

The type or namespace name ‘test’ could not be found (are you missing a using directive or an assembly reference?)

Namespace exists, all references are in place, but the error persists.

Few step to resolve it:

  • close the Visual Studio
  • delete *.suo files from the project
  • re-open the solution
  • rebuild the solution

Source Stack Overlow

Windows Firewall: How to allow all traffic from 1 IP address

Control panel > Windows Firewall > Advanced Settings (in the left side panel). This Opens up an mmc window for advanced firewall configuration.
In the left panel, choose Inbound or Outbound rules.
Right panel, click New rule.
In the dialog, choose “custom”.
In the left again, go to “Scope.” When you add an IP, you can add a range.

For the Remote IP address enter which is localhost.


via Super User

This was happening to me in VS 2010, despite not using R#. After digging through those links @Ryan Spears put in his post I have come across a permanent solution Source. (Note that @Maffelu’s solution did work for me, but it can switch back if I accidentally hit Left Alt + Shift).

This is also weird because Left Alt + Shift doesn’t seem to change it back, so you have to go to the source: a key binding buried in the Windows Control Panel:

Control Panel > Region and Language > Keyboards and Languages > Change Keyboards > Advanced Key Settings > Change Key Sequence > Select “Not Assigned” for both Switching Input Language and Switch Keyboard Layout.


via Stack Overflow.

Start/stop IIS command prompt and shortcuts

In my case following commands work for me

net stop w3svc
net start w3svc

You may need try these as well

net stop iisadmin
net start iisadmin
  • Create shortcut to PowerShell (or console)
  • Right click and Properties
  • In the Target box add at the end of the line net stop w3svc or net start w3svc
  • Click Advanced button and check Run as Administrator