How to release a raster file from locking after deleting it's layer from arcmap using arcobjects

825
1
Jump to solution
10-06-2016 09:50 AM
ShehabAhmed2
New Contributor

I'm creating an addin in which I need to delete the raster file after deleting it's layer from the current map.

The layer is deleted no problem.

ArcMap.Document.FocusMap.DeleteLayer(layerToRemove);

ArcMap.Document.UpdateContents();

ArcMap.Document.ActiveView.Refresh();

Marshal.FinalReleaseComObject(layerToRemove);

The issue is this: when I try to delete the source file, it gives me IO exception that is the file is in use with arcmap process.

Any help will be appreciated.

0 Kudos
1 Solution

Accepted Solutions
ShehabAhmed2
New Contributor

Actually after asking a friend , the perfect working solution is to use the Arcmap delete tool

View solution in original post

0 Kudos
1 Reply
ShehabAhmed2
New Contributor

Actually after asking a friend , the perfect working solution is to use the Arcmap delete tool

0 Kudos