Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use xproj (asp.net/dotnet core project) with shproj (shared project)?

Is it possible to reference a Shared project (.shrpoj) from a .Net core project (.xproj)?

I can't see a way, but I could be missing something.

Update

In case the link below stops working:

The alternative to shproj in .net core world is to add a compile section to the buildOptions section of the project.json file.

For example:

"buildOptions": {
 "compile": {
   "include": [
     "../../shared/**/*.cs"
   ]
 }
}
like image 922
The Bearded Llama Avatar asked Jun 20 '16 14:06

The Bearded Llama


People also ask

How do I add a project reference in NET Core project?

One method of adding references to your library is by typing it directly in the project. json file. As you can see that we have added some references under the dependencies section as shown in the following code. Let us now save this file and you will see that references are added to your library now.

What is .NET shared project?

Shared Projects let you write common code that is referenced by a number of different application projects. The code is compiled as part of each referencing project and can include compiler directives to help incorporate platform-specific functionality into the shared code base.

What is the difference between Microsoft ASP.NET Core App and Microsoft NET Core app?

NET Core vs ASP.NET Core. . NET Core is a runtime to execute applications build on it. ASP.NET Core is a web framework to build web apps, IoT apps, and mobile backends on the top of .


1 Answers

It's not supported. Sorry. You can share the code though by including the code files in project.json

Update

Here's how you include extra source files in a project: https://github.com/aspnet/MusicStore/blob/c83fbdbf127b95d8505b6a55010eb129f23e6530/src/MusicStore/project.json#L7-L12

like image 182
Victor Hurdugaci Avatar answered Sep 19 '22 12:09

Victor Hurdugaci