If you make the decision to remove PostSharp from your project we are sorry to see you leave.
There are two scenarios you may want to consider: removing PostSharp from individual projects or solutions, and removing PostSharp from Visual Studio.
This topic contains the following sections:
Here are some steps to follow to remove PostSharp from your project.
As you'll see in these steps, removing the product from your project is not that difficult. However, replacing the aspects that you were using will be a much more arduous task that will require a great deal of planning.
You will need to replace the aspects by hand-written source code that implement the same behaviors. Depending on how intensively you used PostSharp, your codebase could significantly increase as a result of stopping using PostSharp. Other products and frameworks that pretend to implement aspect-oriented programming actually only provide a small subset of the features you are got used to with PostSharp.
Because every project will use aspects differently, and some will have custom aspects, we are unable to give procedural advise on how to replace specific aspects.
To remove PostSharp from a project, you simply have to remove all PostSharp packages from it. The following procedure demonstrates how to remove PostSharp for the whole solution.
Removing PostSharp with NuGet Packages Manager for Solution
Open the Package Manager for Solution windows
Select the All tab from the left side of the window.
Find the PostSharp packages in the list and select one of the PostSharp Library packages. Click the Manage button.
Start by selecting the PostSharp Library Packages and working in reverse dependency order. This will result in the main PostSharp package being the last one that you select to remove.
Ensure that you uncheck all of the projects listed in the window and click OK.
Repeat steps 3 and 4 for each of the PostSharp packages that show in the Packages Manager for Solution window.
To verify that all of the PostSharp packages have been removed from your codebase, ensure that there are no PostSharp packages listed in the Packages Manager for Solution window.
Once you have removed all of the PostSharp packages from your codebase it is most probable that your application will no longer compile. Compilation errors will be registered where PostSharp aspect attributes exist in the codebase as well as where custom aspects were written. You will need to remove these entries from your codebase to get it to compile again.
Simply deleting the offending code can accomplish this. You must remember that in the process of removing PostSharp from your codebase these errors indicate locations where you are removing functionality from the codebase as well. If the functionality that is being removed is required by the application you will need to determine how to provide that functionality in the codebase going forward. This is the most difficult part of removing PostSharp from yoru codebase. Because aspects can be used in a multitude of different manners, and custom aspects can be created for any number of different uses, there is no practical way to tell you how to replace the functionality being lost.
You now have removed PostSharp from your codebase. At this point you are able to continue on your development effort without making use of PostSharp.
If you would like to remove PostSharp from Visual Studio, proceed with the following steps.
Before you uninstall PostSharp Tools for Visual Studio, we suggest you remove the compiled images.
Removing Native Compiled Images
Open the Visual Studio Options dialog.
Expand the PostSharp node in the tree and select the Compiled Images node.
Select an entry in the listbox and click Uninstall.
Follow the wizard to uninstall the compiled images for the selection you made. There are no choices to be made, simply click Next and Finish until the wizard is completed.
You will need to perform the previous steps for each of the versions listed in the PostSharp Compiled Image page in the Options dialog.
The next step is to remove PostSharp from Visual Studio.
Uninstalling the PostSharp Tools for Visual Studio
Open the Extensions and Updates window.
Select the All tab on the left of the window.
Find the PostSharp entry, select it and click the Uninstall button.
Click Yes to confirm that you want to uninstall the PostSharp extension.
Repeat the two previous steps and uninstall the extension named PostSharp Backward Compatibility Tools.
Restart Visual Studio.
Finally, you can remove the temporary files created by PostSharp. These files would be recreated as necessary the next time you run PostSharp.
Other than occupying disk space, there is no impact of not removing these files.
Cleaning temporary files
Open Windows Explorer and navigate to C:\ProgramData\PostSharp.
Select the C:\ProgramData\PostSharp folder and delete it.