Cannot access LocalDb from Visual Studio 2015 Community Edition

Today I was trying to spin up a quick Web API for an angular project I’m working on in a fresh install of Visual Studio 2015 using Entity Framework Code First.  Unfortunately after creating a simple model, when I tried to update-database to make sure all the moving parts were in a good state I was seeing the following error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 – Local Database Runtime error occurred. The specified LocalDB instance does not exist.)

After some investigation and questioning of whether LocalDB was installed (it was).  I discovered this error is caused by the connection string created by Entity Framework targeting an instance called MSSQLLocalDB which won’t exist.  I believe the error occurs because VS 2015 sees that LocalDB is already installed during installation and therefore doesn’t create this new instance on install.  The fix is to simply replace the instance name of MSSQLLocalDB with v11.0 in DefaultConnection in web.config.

| Tagged , | Leave a comment

CRM 2013 Solution Export Issue

Recently I was having problems exporting a solution from an on-premise CRM 2013 organisation. Unusually there was no additional log to download and turning on verbose logging allowed me to see the exception being thrown on export but there was no indication to the source of the error.

I eventually resolved the problem by process of elimination, removing likely candidates from the solution until I could export successfully. It turned out to be an errant Routing Rule Set which was configured for forwarding to a queue but the queue wasn’t defined. Since you can’t create a rule and forward to a queue without defining the queue, I assume it must be due to the solution having originally been imported unmanaged and the queue name defined in the Rule Set not existing on import.

If you’re struggling with a solution export, import or delete I’d recommend verifying the Routing Rule Sets and Case Creation Rules first.

| Leave a comment

CRM 2013 Issue – systemform With Id = {guid} Does Not Exist

Solution Import Error systemform With Id = {guid} Does Not Exist

I was struggling with this error recently whilst trying to import a managed solution into a CRM 2013 SP1 integration environment.  It turns out that the form that it was telling me didn’t exist was a Quick Form that did!

Having confirmed the form existed in the org and solution I exported from I decided to open up the zip file to have a look through the customizations.xml file. I searched for the guid and could see that the Quick View form was as expected included correctly and the reference to it from the related form was also included.

The only thing I could think was that the form that referenced the quick view form was included in the Xml before the actual form that contained the quick view definition. I moved the element containing the quick view form above the that was referencing it, repackaged and tried again. This time the import work successfully!


1. Open up your solution zip and edit the customizations.xml file searching for the guid provided in the solution import error log.

2. For each <Entity> that uses the Quick Form you’ll see it contains a <QuickFormIds> element similar to that shown below.  You need to make sure that the <Entity> element for the entity it refers to (xyz_entityName in this case) appears in the file BEFORE the <Entity> that is referencing it via the QuickFormIds element.

<QuickFormIds><QuickFormId entityname=”xyz_entityName”>33d82ce4-0648-477c-a1b8-08ddd4b6e5be</QuickFormId></QuickFormIds>

Looks like a bug that will hopefully get sorted in the next rollup.

| Tagged | 3 Comments

Configuring visual diff and merge tools for git on Windows

There’s plenty of information available on the net for configuring your visual diff/merge tool of choice for git. However, a lot of it is out of date. As of Jan 2014 using git v 1.8.4 this is the concise guide to setting up your visual diff and merge tool(s) of choice.

Add the following to your .gitconfig. If you don’t know what that is go here.

   external = C:\\Program Files\\Perforce\\p4merge.exe
    tool = p4merge
[difftool “p4merge”]
    cmd = p4merge.exe $LOCAL $REMOTE
    prompt = false
    tool = p4merge
[mergetool “p4merge”]
    cmd = p4merge.exe $BASE $LOCAL $REMOTE $MERGED

I’m using p4merge by Perforce. It’s free and supports the git three way merge well. If you want to use any other tool of choice add it to your path and replace the references to the .exe accordingly.

| 1 Comment

Avoid storing Nuget packages in your Git Repository

Git is a fantastic version control system but it was never designed for storing binary files. They clutter the history and even if removed that history must still be maintained. Ideally a remote pull should be a fast and pain free operation; one of the core tenets of git is speed. Something that anyone who has spent any amount of time within TFS will appreciate.

The screenshot below shows the packages folder of a newly created ASP.NET MVC 4 project. I appreciate some of these are scripts but that’s 47MB (before adding any project specific packages such as DI or Mocking) of binary data your git repo needs to maintain history for, binary history that you’re unlikely to ever care about.

You may now be thinking “What if we need to revert to an earlier build?”.  You can still do this using the exact same binary versions as when you created the commit. Simply check out the commit and build the solution as normal. Your packages will be restored to the exact versions at the time of the commit because the packages.config file which defines the versions of those packages is stored in your repo.

Let’s fix this…

  1. Enable NuGet Package Restore by right clicking on your VS solution. This will as the name suggests ensure on build of the solution that all package dependencies are pulled in from the configured nuget repositories. What to restore is defined in the packages.config file which is stored in the root of each project in the the solution. As mentioned earlier these will be version controlled which is what allows us to always restore source and package dependencies for any commit in the history. More info on this feature is available on the NuGet website.

  1. Add the line packages/ to your gitignore file. This is the important bit and something a lot of people forget to do.
  2. Commit the changes to the repo.
  3. That’s it we’re done!

Make sure you do this BEFORE the initial commit to the repo.

| Tagged , | Leave a comment

CRM 2011 SDK Dependency Starter now on Nuget

Each time I want to create a quick project in Visual Studio to connect to CRM 2011 I head to the SDK and pull in Microsoft.Xrm.Sdk then the source code for the helper classes and finally resolve all the missing framework dependencies IdentityModel, DirectoryServices etc.  The latter being made considerably easier with Resharper.

I’ve been meaning to package up this process that I’ve now repeated far too many times and throw it up on Nuget.  I finally managed to find the huge 10 minute commitment it eventually took to get this done tonight.

Available on the gallery or to install the package in Visual Studio just open up the Package Manager console and type:

install-package CRMSDKDependencyStarter

or for those of us averse to typing you can shorten this with:

install-p [tab] crm [tab] 

| Tagged | Leave a comment

Taking Team Foundation Service for a quick spin

Having just watched Brian Keller’s talk at //Build online I decided to give the new Team Foundation Service offering a spin. It’s free for teams of up to five users and whilst in preview also free for larger teams. No confirmed pricing plans yet so let’s hope MS don’t go silly if they really want to complete with the likes of GitHub and AppHarbor.

Setup is an absolute breeze having just created an account with my Live ID I was able to create a Team Project and start creating tasks in seconds. Make sure you pick your org name carefully as it cannot be changed at a later date. It also forms part of your URL so company name will be the obvious choice over a specific project name.

Hooking into Visual Studio 2012 is equally easy using the Team Explorer dialog to add a new server you just enter your URL and you’ll be prompted for Live ID and you’re up and running. I just tried creating a task, pushing it to Outlook (2013) and following the link to view online and all went well. Having been through the pain of setting up an on-premise TFS environment including the SharePoint, SQL Reporting and Build Controllers this is a real step forward for smaller teams and I’ll definitely be digging in a lot more.

In an upcoming post I’ll be taking a closer look at the Azure Continuous Deployment Build Definition and comparing this with the new Continuous Deployment offering for GitHub and CodePlex integration introduced to Azure Websites recently.

If you want to try out any of the new Azure features head over to the Azure Website and sign up for the 10 free Azure Websites offering. Alternatively, if you’re a Microsoft Partner you can sign up for Cloud Essentials for your Azure access and whilst you’re there why not get on board with CRM 2011 Online and Office 365 partner access.

| Leave a comment