3

I cannot find the problem within my ASP.NET Core application. After deployment on azure it says: Internal server error. Exception:

InvalidOperationException: Can not find assembly file dotnet-razor-tooling.exe at 'D:\home\site\wwwroot\refs,D:\home\site\wwwroot\'

project.json:

{
  "dependencies": {
    "Microsoft.AspNet.WebApi.Client": "5.2.3",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Mvc.WebApiCompatShim": "1.0.0",
    "Microsoft.AspNetCore.Razor": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.DependencyInjection": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Net.Http.Server": "1.0.0-beta6",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "NLog": "4.3.7",
    "NLog.Extensions.Logging": "1.0.0-rtm-alpha4",
    "NLog.Interface": "3.2.1",
    "PostSharp": "4.3.15"
  },

  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "net452": {
      "dependencies": {
        "JECodingTest.Business": {
          "target": "project"
        }
      }
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Tried to update Razor, but id did not help me. Any suggestions?

3
  • You mentioned trying to update Razor, but your project.json still references 1.0.0-preview1-final. The latest version is preview2. Have you tried that version? Commented Aug 15, 2016 at 15:35
  • 1
    Thanks Nate! I had to tap "include pre-release" checkbox, so that update appeared. updating to v1.0.0-preview2-final - fixed the trouble!
    – Alex
    Commented Aug 15, 2016 at 16:29
  • Great! I'll create an answer in case anyone else runs into it. Commented Aug 15, 2016 at 17:31

1 Answer 1

4

This error can occur if you're using an older version of the Razor tooling packages. In your project.json, you have:

"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview1-final",
  "type": "build"
},

The latest version at the time of writing is 1.0.0-preview2-final. You can update the packages by editing the project.json file directly, or by using the NuGet Package Manager GUI (make sure to select Include Prerelease).

Make sure that both the package reference in the dependencies section and the reference in the tools section get updated.

Not the answer you're looking for? Browse other questions tagged or ask your own question.