PostSharp 5.0 / / Post­Sharp Documentation / Deployment and Configuration / Deployment / Uninstalling Post­Sharp

Uninstalling PostSharp

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:

Removing PostSharp from your projects and solutions

Here are some steps to follow to remove PostSharp from your project.

Caution note Caution

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 handwritten 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 provide you with any generic piece of advice about 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

  1. Open the Package Manager for Solution windows

    uninstall 4
  2. Select the All tab from the left side of the window.

    uninstall 5
  3. Find the PostSharp packages in the list and select one of the PostSharp Library packages. Click the Manage button.

    uninstall 6
    Note Note

    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.

  4. Ensure that you uncheck all of the projects listed in the window and click OK.

    uninstall 7
  5. Repeat steps 3 and 4 for each of the PostSharp packages that show in the Packages Manager for Solution window.

  6. 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 your 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.

Note Note

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.

Removing PostSharp from Visual Studio

Before you uninstall PostSharp Tools for Visual Studio, we suggest you remove the compiled images.

Removing Native Compiled Images

  1. Open the Visual Studio Options dialog.

    uninstall 8
  2. Expand the PostSharp node in the tree and select the Compiled Images node.

    uninstall 9
  3. Select an entry in the list box and click Uninstall .

    uninstall 10
  4. 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.

    Note Note

    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

  1. Open the Extensions and Updates window.

    uninstall 12
  2. Select the All tab on the left of the window.

    uninstall 13
  3. Find the PostSharp entry, select it and click the Uninstall button.

    uninstall 14
  4. Click Yes to confirm that you want to uninstall the PostSharp extension.

    uninstall 15
  5. Repeat the two previous steps and uninstall the extension named PostSharp Backward Compatibility Tools.

  6. 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

  1. Open Windows Explorer and navigate to C:\ProgramData\PostSharp.

    uninstall 11
  2. Select the C:\ProgramData\PostSharp folder and delete it.