Monday, September 26, 2016

Could not load file or assembly Microsoft.Data.Entity.Build.Tasks.dll or one of its dependencies

I created a new project in Visual Studio 2015 and when I attempted to build, received the following error:

The "EntityClean" task could not be loaded from the assembly c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.Build.Tasks.dll.
Could not load file or assembly 'file:///c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.Build.Tasks.dll' or one of its dependencies

Thursday, September 1, 2016

Running Node.js (npm) behind a proxy

At work I've installed and used node.js (npm) several times.  Every time I use npm it generates the following errors when it's first run:
    
    npm ERR! network connect ETIMEOUT
    npm ERR! network This is most likely not a problem with npm itself
    npm ERR! network and is related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad networ settings.
    npm ERR! network
    npm ERR! network If you are behind a proxy, please make sure that the
    npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

These errors indicate that you Here's how I fixed it. It turns out to be pretty basic. npm uses a series of configuration settings, which can be accessed by using npm config as follows:
  • call npm config list to see all of the current configuration settings
  • call npm config get to retrieve the value a specific configuration setting
  • call npm config delete to remove a specific configuration setting
  • call npm config set to set a value for a specific configuration setting
So to fix my problem behind the firewall, I just needed to run two commands to configure my proxy:

npm config set proxy http://proxy.mycompanyname.com:8080
npm config set https-proxy http://proxy.mycompanyname.com:8080

Friday, May 13, 2016

The type 'DbContextOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework.Core

I'm building my first ASP.NET 5 application.  I've added my references to my project.json file, but when I added the latest 7.0.0-rc1-final SQL references it broke my DbContextOptionsBuilder class.  I get the following error:

The type 'DbContextOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework.Core'

Here's what my project.json file originally looked like after I updated several of the SQL references to 7.0.0-rc1-final.  The EntityFramework.SqlServer didn't have a 7.0.0-rc1-final version:

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "EntityFramework.Core": "7.0.0-rc1-final",
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.SqlServer": "7.0.0-beta8"
  }

Fix:  It turned out that theEntityFramework.SqlServer got renamed to EntityFramework.MicrosoftSqlServer.  Once I referenced the new name, my errors went away.  Here's my updated dependency list.

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "EntityFramework.Core": "7.0.0-rc1-final",
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final"
  }

Monday, March 28, 2016

The dependency Microsoft.AspNet.Mvc >= 6.0.0-rc1-final could not be resolved.

I got this error when adding MVC to my ASP.NET 5 project.   My project.json contained the following dependencies, and I was getting an error that it couldn't resolve the second one.

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
  },

The error I was getting was:

The dependency Microsoft.AspNet.Mvc >= 6.0.0-rc1-final could not be resolved.

Fix:

It turned out that I just needed to run "dnvm upgrade " from my command prompt with VS closed.

Once I'd run this command, VS then resolved the dependency correctly.