Cannot publish ASP.NET 5 that references Azure class library

Initially, I had an ASP.NET 5 working draft that could be published to Azure without problems. Then I decided to split the DAL into a separate class project, but ran into many dependency problems. Then I decided to create an empty project with an empty class library to find out if I can decide what the problem is, but I can't even post it.

Steps:

  • Create a new ASP.NET 5 Web API Preview Template project (also create a solution).
  • Add a class library to the solution.
  • Change the target class library infrastructure for .NET 4.5.1 from 4.6
  • Class class library from an ASP.NET 5 project.
  • Attempt to publish.

This is the project structure:

enter image description here

Received ASP.NET 5 project.json :

 "frameworks": { "dnx451": { "dependencies": { "ClassLibrary1": "1.0.0-*" } }, "dnxcore50": { } }, 

Therefore, it is successfully referenced, and I can create and deploy it on my own hosting, but if I try to publish it to Azure, I get the following error message:

 The "Dnu" task failed unexpectedly. System.Exception: Microsoft .NET Development Utility CLR-x86-1.0.0-beta6-12256 Copying to output path C:\Users\MyUserDir\AppData\Local\Temp\PublishTemp Time elapsed 00:00:04.1309210 at Microsoft.DNX.Tasks.Dnu.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder. <ExecuteInstantiatedTask>d__26.MoveNext() 

I am using Visual Studio 2015 and ASP.NET 5 Beta 7.

EDIT: After some games, I don't think my answer is completely right. Now I understand that there are cases when you cannot use a new type of class library, for example. existing old class libraries that might not be practical for the port. Is there any way to do this?

I tried doing dnu publish and it publishes fine. Then I go to the FTP output to the server, but then it gives me a Runtime Error . I tried to debug it remotely using Visual Studio. I see that exceptions occur when accessing the site, but I can’t understand what the problem is. One of the first exceptions:

Exception thrown: 'System.InvalidOperationException' in AspNet.Loader.dll

When I looked at the magazines, he gave me Couldn't determine an appropriate version of runtime to run.

+5
source share
1 answer

Turns out I used the wrong class library project. I apparently used the old class library, not the new version of PREVIEW , which is also labeled (Package) .

Class library project

The description threw me a little, because he said that he was used to create NuGet packages, but now everything works fine, and the ASP.NET 5 project can be deployed to Azure with a successful link to the class library.

+1
source

All Articles