How to work with multiple .net projects on os x an

2019-06-04 19:29发布

问题:

I am trying to create a typical solution/project layout using vs code. I created the various libraries using yo aspnet, but I don't know how to reference projects in vs code. Do I use a single project.json at the root? How does it know what the startup project and entry point are? Also, is there a way to get intellisense on the namespacing?

回答1:

If you don't use Visual Studio (the full version), then you don't need a solution or xproj files. You just use folders and project.json files to mark your projects then each project can add a reference to another one in the dependencies section of the project file, like in this example:

https://github.com/aspnet/Configuration/blob/1b302daf1c9bf7e723a26f5507f033c3e313e106/src/Microsoft.Extensions.Configuration.Ini/project.json#L20-L23

Edit (summary of the comments):

  • To reference projects in other folders, add them to the global.json file
  • To get intellisense in VS code, you must select a project (there's a drop down in the lower right corner of the window)