Installing PostSharp Into a Project
The compiler components of PostSharp are distributed as a PostSharp NuGet package. If you want to use PostSharp in a project, you simply have to add this NuGet package to the project.
This topic contains the following sections:
To add PostSharp to a project:
Open the Solution Explorer in Visual Studio.
Right-click on the project.
Click on Manage NuGet packages.
Click on the Browse tab.
Search for the PostSharp package.
Select the PostSharp package and click on Install.
Remember that adding PostSharp to a project just means adding the PostSharp NuGet package. If you want to add PostSharp to several projects in a solution, it may be easier to use NuGet to manage packages at the solution level. You may need to select the Include Prerelease option to install a prerelease version of PostSharp.
There are other ways to manage NuGet packages in your projects. See NuGet Package Consumption Workflow documentation for more information.
NuGet Package Manager can be configured using a file named nuget.config, which can be checked into source control and can specify, among other settings, the location of the package repository (if it must be shared among several solutions, for instance) or package sources (if packages must be pre-approved). See NuGet Configuration File and NuGet Configuration Settings for more information.
After you add PostSharp to a project, you need to add the following files to source control:
postsharp.config, if any
*.psproj, if any
*.pssln, if any
Some of the files above might not be present depending on the package management format you use (packages.config/PackageReference) and on which PostSharp packages you have installed in your project.
Optionally, if you use the packages.config package management format, you can also include the packages folder in your source control. Note that there are negative consequences on this practice. See Omitting NuGet packages in source control systems for more information. If you choose not to include the packages folder in your source control system, read Restoring Packages at Build Time.
Once you have all of these files included in your source code repository, any other developer getting that source code from the repository will have the required information to be able to build the application.