简体   繁体   中英

.NET5 on OSX - C# errors in DNVM shell (so close..)

I'm trying to get an old project to run on the new .NET VM, I've gotten through a few obstacles at this point. For a while I couldn't get DNVM to recognize my project as a .NET project, until I added a couple missing files from a sample project, and used dnvm . kestrel dnvm . kestrel instead of dnvm . web dnvm . web and then I got back about 80mb worth of C# errors...

So I went from not being recognized as a project, to being recognized as a shitty one :/

Anybody beat this level yet? Thank you in advance.

Two questions for you

  1. When you say that you tried dnvm . kestrel dnvm . kestrel , do you mean that you tried dnx . kestrel dnx . kestrel ?
  2. Did you run dnu restore to download dependencies before running dnu . kestrel dnu . kestrel ?

Three command line programs

There are three command line programs that you will use to run a .NET 5 app, and it's easy to confuse them. dnvm is the version manager, dnu is the utility, and dnx is the runtime. It's the runtime not the version manager that you use from your project's root folder to start the kestrel web server.

Startup up an app

Here's the very short version of how to start up a .NET 5 app. After using dnvm to install .NET 5, and after creating a project (and optionally a solution,) you need to use both dnu and dnx in this sequence.

  1. From your solution's folder, run dnu restore . This will download your project's dependencies. If you have only a project and no solution, run this from your project's folder instead.
  2. From your project's folder, run dnx . kestrel dnx . kestrel to run the web application in the browser.

It sounds like you did number (2) without having first done number (1).

Let me know whether you're able to reach the next level. Also, have you read these articles?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM