Try to run newly created ASP.NET vNext project on Ubuntu but got errors

494 views Asked by At

I want to try new ASP.NET 5(also called vNext?), so I downloaded ubuntu-14.04.2-server-amd64.iso, installed in VMware Player and running.

After installation, I run the following command:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install nodejs-legacy npm
  • sudo npm install -g gulp
  • sudo npm install -g bower

Reference to https://github.com/aspnet/home, I follow the steps:

  1. get mono
  2. get libuv
  3. Get DNVM
  4. Add Sources to NuGet.config

Then I create a ASP.NET project selecting "Web site" in "ASP.NET 5 Preview Template" (Visual Studio Community 2015 RC). I uploaded the entire project folder to ubuntu server running in VMware Player.

Just follow the steps again:

  1. cd to project folder
  2. dnu restore

(download and install ...) Writing lock file /home/ubuntu/vNext/WebApplication1/src/WebApplication1/project.lock.json npm WARN package.json [email protected] No description npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No README data [18:04:44] Warning: gulp version mismatch: [18:04:44] Global gulp is 3.9.0 [18:04:44] Local gulp is 3.8.11 [18:04:44] Using gulpfile ~/vNext/WebApplication1/src/WebApplication1/gulpfile.js [18:04:44] Starting 'clean'... [18:04:44] Finished 'clean' after 5.43 ms [18:04:44] Starting 'copy'... [18:04:44] Finished 'copy' after 16 ms Restore complete, 217628ms elapsed

  1. dnx . kestrel

System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1': EntityFramework.Commands 7.0.0-beta4 EntityFramework.SqlServer 7.0.0-beta4 Microsoft.AspNet.Authentication.Cookies 1.0.0-beta4 Microsoft.AspNet.Authentication.Facebook 1.0.0-beta4 Microsoft.AspNet.Authentication.Google 1.0.0-beta4 Microsoft.AspNet.Authentication.MicrosoftAccount 1.0.0-beta4 Microsoft.AspNet.Authentication.Twitter 1.0.0-beta4 Microsoft.AspNet.Diagnostics 1.0.0-beta4 Microsoft.AspNet.Diagnostics.Entity 7.0.0-beta4 Microsoft.AspNet.Identity.EntityFramework 3.0.0-beta4 Microsoft.AspNet.Mvc 6.0.0-beta4 Microsoft.AspNet.Mvc.TagHelpers 6.0.0-beta4 Microsoft.AspNet.Server.IIS 1.0.0-beta4 Microsoft.AspNet.Server.WebListener 1.0.0-beta4 Microsoft.AspNet.StaticFiles 1.0.0-beta4 Microsoft.AspNet.Tooling.Razor 1.0.0-beta4 Microsoft.Framework.CodeGenerators.Mvc 1.0.0-beta4 Microsoft.Framework.ConfigurationModel.Json 1.0.0-beta4 Microsoft.Framework.ConfigurationModel.UserSecrets 1.0.0-beta4 Microsoft.Framework.Logging 1.0.0-beta4 Microsoft.Framework.Logging.Console 1.0.0-beta4 Microsoft.VisualStudio.Web.BrowserLink.Loader 14.0.0-beta4 Searched Locations: /home/ubuntu/vNext/{name}/project.json /home/ubuntu/vNext/WebApplication1/src/{name}/project.json /home/ubuntu/vNext/WebApplication1/test/{name}/project.json /usr/lib/mono/4.5/{name}.dll /usr/lib/mono/4.5/Facades/{name}.dll Try running 'dnu restore'.

at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in :0

And here goes errors

I tried to run "dnu restore -s https://www.myget.org/F/aspnetvnext/api/v2/" in project folder, but got some other errors

(download and install ... )
[17:48:08] Warning: gulp version mismatch:
[17:48:08] Global gulp is 3.9.0
[17:48:08] Local gulp is 3.8.11
[17:48:08] Using gulpfile ~/vNext/WebApplication1/src/WebApplication1/gulpfile.js
[17:48:08] Starting 'clean'...
[17:48:08] Finished 'clean' after 2.25 ms
[17:48:08] Starting 'copy'...
[17:48:08] Finished 'copy' after 20 ms
Restore complete, 358056ms elapsed
Errors in `/home/ubuntu/vNext/WebApplication1/src/WebApplication1/project.json
    Unable to locate Microsoft.VisualStudio.Web.BrowserLink.Loader >= 14.0.0-beta4
    Unable to locate Newtonsoft.Json >= 6.0.6
    Unable to locate System.Collections.Immutable >= 1.1.36
    Unable to locate System.Reflection.Metadata >= 1.0.21
    Unable to locate Ix-Async >= 1.2.3
    Unable to locate Remotion.Linq >= 2.0.0-alpha-002

So, the question is, Am i do something wrong, or the default ASP.NET vNext project create by Visual Studio 2015 RC cannot run under Ubuntu(and other Linux distributions)?

1

There are 1 answers

0
Edgar G On BEST ANSWER

I believe your application is targeting the full .NET 4.5.1 framework, which is only available for Windows. You can use DNX with .NET451 (Windows), .NET Core (Cross Platform) and Mono (Cross Platform).

Try targeting .NET Core. Another option would be to create a new project "the Linux way" using Yeoman.

Key points in output:

System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1'

And also some IIS references are there :)

Microsoft.AspNet.Server.IIS 1.0.0-beta4