A project I'm working on is currently using 2 entities projects and it's written over .Net Standard 2.0 framework:
Contract.csproj
Contract.Internal.csproj
The first is configured to be exposed for consumers using a private Nuget server, while the second is for internal use of my solution projects.
The thing is that both has pretty much the same classes except few that are for my solution internal use only.
Is there a way to merge them to a single project and configure some classes to be exposed in the NuGet package while others are not?
I read on the ExcludeAssets/IncludeAssets tags that can be added to the csproj PackageReference, but the docs and all the examples I saw are referring dependencies and their versions and not the project classes.
Also, if you have other solution, you work with your projects some other way on this one (Or even think that I find myself with that scenario is wrong) I'll be more than happy if you share you thoughts on this.
CodePudding user response:
If you want to expose certain classes from your project while keeping other classes internal, you can use C# access modifiers.
For example, a class prefixed with internal
will be only visible inside your project:
internal class Foo { }
A class prefixed with public
will be accessible for others:
public class Bar { }
CodePudding user response:
Make your project Contract.Internal.csproj
inherit the functionality provided in Contract.csproj
see: Inheritance - derive types to create more specialized behavior