Publishing Projects In .NET Core repository Into NuGet

🕓 15 minutes

What you’ll learn#

How to publish your projects from your .NET Core application repository, so you can use them in another application component. It is useful when you have a project/API that you want to use in more than one component.

Steps#

  1. Open repository of your .NET Core project on GitLab.gitlab_repository
  2. If you see a file named submoduleToPublish open it, otherwise create a new file with the name submoduleToPublish in the root of repository.submoduleToPublish_location
  3. In this file, write down all of the projects that you want to share between components. Each one on a new line in this format: SubmoduleName/SubmoduleName.csproj. For example: Nis.Carrier.Info.Svc.Api/Nis.Carrier.Info.Svc.Api.csprojshared_projects_in_file
  4. After you build your component containing the file named submoduleToPublish, you will find your published projects in NuGet repository under this structure: componentName/submoduleName/version/submoduleName.version.nupkg
  5. If everything goes right, you can now use your published projects as a dependency in your other application components.

What’s next?#

You might be interested in our other tutorials: