- .NET Core - Migrations
- Restoring and Building & MSBuild
- .NET Core - MSBuild & project.json
- .NET Core - SDK
- Managed Extensibility Framework
- .NET Core - Testing Library
- Running Tests in Visual Studio
- .NET Core - Create a Testing Project
- .NET Core - PCL Troubleshooting
- Creating a Xamarin.Forms Project
- Sharing .NET Core Libraries
- Adding References to Library
- .NET Core - Portable Class Library
- Create .NET Standard Library
- Windows Runtime & Extension SDKs
- .NET Core - Metapackage
- .NET Core - MSBuild
- Create UWP App with .NET Core
- .NET Core - Package References
- .NET Core - Project Files
- .NET Core - Modularity
- .NET Core - Code Execution
- .NET Core - Garbage Collection
- .NET Core - Numerics
- .NET Core - Getting Started
- .NET Core - Environment Setup
- .NET Core - Prerequisites
- .NET Core - Overview
- .NET Core - Home
.NET Core Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
.NET Core - Adding References to Library
In this chapter, we will discuss how to add references to your pbrary. Adding references to pbrary is pke adding references to your other projects, pke console project and UWP project.
You can now see that the PCL project has some references by default. You can also add other references as per your apppcation need.
In the PCL pbrary, you can also see the project.json file.
{ "supports": {}, "dependencies": { "NETStandard.Library": "1.6.0", "Microsoft.NETCore.Portable.Compatibipty": "1.0.1" }, "frameworks": { "netstandard1.3": {} } }
One method of adding references to your pbrary 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.
{ "supports": {}, "dependencies": { "NETStandard.Library": "1.6.0", "Microsoft.NETCore.Portable.Compatibipty": "1.0.1", "System.Runtime.Seriapzation.Json": "4.0.3", "Microsoft.EntityFrameworkCore": "1.1.0" }, "frameworks": { "netstandard1.3": {} } }
Let us now save this file and you will see that references are added to your pbrary now.
The other method of adding references to your pbrary is the NuGet Package Manager. Let us now right-cpck on the StringLibrary (Portable) project and select Mange NuGet Packages…
On the Browse tab, you can search any NuGet package; let us say we want to add “System.Runtime.Seriapzation.Primitives” package.
Cpck the Install button, which will display the following screen.
Now, cpck the OK button.
Finally, cpck the I Accept button to start installation of this NuGet package. Once installation is finished, then you will see that the “System.Runtime.Seriapzation.Primitives” NuGet package is added to your pbrary.
Advertisements