AnsweredAssumed Answered

How do I access my LayerFiles in my Addin?

Question asked by geonetadmin on Apr 12, 2011
Latest reply on Apr 13, 2011 by geonetadmin
Original User: Hornbydd

All,

I've been developing my first ever ArcGIS 10 Addin. If I have understood the help correctly I can embed files into my addin, I have done this with 3 LayerFiles. See image below titled folderstructure, I have also set the Copy to Output Directory to Copy always.

I use the following bit of code to get a handle on the path:

Dim s As String
Dim path As String
s = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location)
path = System.IO.Path.GetDirectoryName(s) & "\Layer Files\"


So I build the project in VS2008 and then copy JUST the esriAddIn file to c:\temp.
When I run the tool to try and get a handle on the LayerFile inside the esriAddIn file I get the error message as shown by the image title errormessage. Note this has a very different path.

Have I misunderstood what an embedded file can be? If not how do you drill down to the LayerFile as ultimately I want to get hold of the symbology store inside it with code similar to below:

s = path & "Polygon.lyr"
pLayerFile = New LayerFile
pLayerFile.Open(s)
pLayer2 = pLayerFile.Layer
 pGeoFeatureLayer2 = pLayer2
pGeoFeatureLayer.Renderer = pGeoFeatureLayer2.Renderer
pLayerFile.Close()


Duncan

Attachments

Outcomes