ASP.net (MVC 5) application not running on Linux. Missing dependencies? Incompatible with Linux? Help!


#1

Hi,

I’m having troubles making a web app developed in ASP.net (MVC 5) to run on a Ubuntu 16.04 machine. The web app has been developed in Windows using Visual Studio 2015.

On my Linux machine I’ve installed the dotnet Core Package as explained in https://www.microsoft.com/net/core#linuxubuntu

I created the project.json file where I specified all dependencies.I setup the project with dotnet restore. When I use the command dotnet run this error gets thrown:

/home/me/Documents/MYWeb/MYWeb.csproj(187,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/1.0.0-rc3-004530/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Here are the project.json contents:

{
	"dependencies": {
		"Antlr": "3.4.1.9004",
		"bootstrap": "3.0.0",
		"jQuery": "1.8.0",
		"jQuery.Validation": "1.11.1",
		"Microsoft.AspNet.Mvc": "5.2.3",
		"Microsoft.AspNet.Razor": "3.2.3",
		"Microsoft.AspNet.Web.Optimization": "1.1.3",
		"Microsoft.AspNet.WebPages": "3.2.3",
		"Microsoft.CodeDom.Providers.DotNetCompilerPlatform": "1.0.0",
		"Microsoft.jQuery.Unobtrusive.Validation": "3.2.3",
		"Microsoft.Net.Compilers": "1.0.0",
		"Microsoft.Web.Infrastructure": "1.0.0.0",
		"Modernizr": "2.6.2",
		"Newtonsoft.Json": "6.0.4",
		"Respond": "1.2.0",
		"WebGrease": "1.5.2"
	},
	"frameworks": {
		"net452": { }
	},
	"runtimes": {
		"win": { }
	}
}

Anybody knows how to fix the issue? Why is it requesting to use VisualStudio/v10.0 instead of the VisualStudio/v13.0 as it is using on the Windows development machine?

When I copy the version 13 to my Linux machine and rename it to 10 (Not the best way to do it), it complains that the required DotNet target version is not installed, but there is nowhere any command to install it neider.

On the other hand I tried to install Kestrel, but failing to install DNVM as it doesn’t exist anymore in the github repository. (https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh)

Any help or remarks are highly apreciated.

Greetings.


#2

Hi @rkk_bor,

Your project.json says it all. You’re building the project to run on net452 framework for the win runtime. This means that for your app to work, it needs to be running on a Windows machine with the full .NET Framework installed (not .NET Core), you might need to install Mono on the linux server. Also, MVC5 is not supported by ASP.NET Core, go (use MVC6) here to learn how to migrate to MVC6.

-Toni


#3

you can easily to create a web application from scratch with command dotnet new --type web on Linux
which would help you out there and keep moving with default workable project, you’re able to make any changes as per your requirements. hope it helpful


.NET Foundation Website | Blog | Projects | Code of Conduct