Aug 02

Publishing to Azure: Could not load file or assembly ‘Microsoft.Web.XmlTransform,Version=1.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies

When publishing my MVC 5 webapp to Azure I get the error:

The “ImportParametersFile” task failed unexpectedly. System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Web.XmlTransform,Version=1.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. File name: ‘Microsoft.Web.XmlTransform, Version=1.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’

I’m using Visual Studio 2012 Update 4. Azure SDK 2.3.

I’ve tried:

– reinstall azure SDK
– reinstall Web Tools 2013.1 for VS2012
– installed slowcheetah nuget package
– installed Microsoft.Web.xdt nuget package
– uninstalled VS 2013

So far no luck, the Microsoft.Web.Xmltransform.dll is just missing and the version that is somewhere on my system is the wrong version. I’ve tried to find the 1.4.0.0 version somewhere, but it seems unfindable.

MY SOLUTION:

– repair Microsoft ASP.NET & Web Tools 2013.1 Visual Studio 2012

reinstall does not work

May 10

Could not load file or assembly ‘system.web.http’ file not found when running custom tool on Typelite

I got the error message Could not load file or assembly ‘system.web.http’ file not found when running custom tool on Typelite. File not found. This was after updating some nuget packages.

The issue is that apperently there are several version installed. How to get rid of this misery:

– start the nuget package manager console in Visual Studio

– type: update-package (all packages are updated)

– type: get-package (you get a list of installed packages)

– remove all packages from old versions (e.g.: uninstall-package xxxx.yyy -Version 1.0.0)

– if still an old assembly exists in the references, delete it and reinstall the package (UpdatePackage <PACKAGE>  reinstall

– run update-package again

If you get a message that the package is not installed, install it! (install-package <PACKAGE NAME>

All should work now (at least it did for me)

 

May 06

Error making asyn call in Entity Framework: There is already an open DataReader associated with this Command which must be closed first

Using Entity Framework 6.0 I got this message. This problem occurs when mostly in Async environment. This is due to a reader (in the same DBContext) that is still open, while another reader tries to open an new one. Typically this is a async issue.

In my MVC 5 app I have a Async call to my webapi. My problem was that I created a second repository object in a method, while the first repository was created by Unity Dependency Injection Framework was not finished reading.

My solution:

In stead of newing the repository up in the method I injected it in the constructor and all issues where solved.

A better solution:

Add MultipleActiveResultSets=True to the connectionstring of the database.

Apr 11

Entity Framework is returning old data when using Webapi

Strange thing today. I have a MVC 5 webapp, that has Webapi capabilities used. Problem is that I get old data when retrieving it from a Webapi controller, but fresh data when retrieving directly from the database.

The issue was in the user of automapper. I had automapper map a datetime taking the timezone in account. I had to search in the database to get the right timezone. There the old value was presented. Probably due to Dependency Injection, there was a different databasecontext loaded, that did not see changes made.

Solution: quit using automapper and map the properties manual in my own Mapper class.