Originally I had a working ASP.NET 5 project that could be published to Azure with no problems. I then decided to split the DAL into a separate class project but came across many dependency problems. I then decided to create a blank project with a blank class library to see if I could work out what the problem was but I cannot even publish that either.
Steps:
This is the project structure:
The resulting ASP.NET 5 project.json
:
"frameworks": {
"dnx451": {
"dependencies": {
"ClassLibrary1": "1.0.0-*"
}
},
"dnxcore50": { }
},
So it references successfully and I can build and deploy on self 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 playing around, I don't think my answer is quite right. I now realise that there are cases where one can't use the new type of class library e.g. existing older class libraries, which may be impractical to port. Is there some way to do this?
I have tried doing dnu publish
and it publishes perfectly fine. I then FTP the output onto the server but then it gives me a Runtime Error
. I tried to remotely debug it using Visual Studio. I can see exceptions being thrown when I access the site but I have no way to see what exactly the problem is. One of the first exceptions thrown is:
Exception thrown: 'System.InvalidOperationException' in AspNet.Loader.dll
When I looked in the logs, it gave me Couldn't determine an appropriate version of runtime to run.
It turns out that I was using the incorrect Class Library project. I was apparently using the old Class Library and not the new PREVIEW
version, which is also labelled with (Package)
.
The description threw me off a bit as it said it was used to create NuGet packages but now everything works fine and the ASP.NET 5 project can be deployed to Azure with successful reference to the Class Library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With