Improvement: change behavior to allow xml file in wsp

Mar 4, 2009 at 12:03 PM
Edited Mar 4, 2009 at 12:05 PM
for specification of fields.
Turns out by debugging why on earth activating the feature would not work in a farm, that the reason is simply the code getting the string for the file and trying to access it.

However, by changing the code internal behavior to do this:
                        //simple file name, needs exact location, add feature root "guesswork"
                        sFilePath = properties.Feature.Definition.RootDirectory + "\\" + sFilePath;
   XmlTextReader xReader = new XmlTextReader(sFilePath);

allows the code to access an .xml file packaged within the wsp.
Thus discontinuing the need to "control" a file external to the feature.....
Of course one needs to point to the file still, within the feature XML property with fields like "mycolumndefinitionfile.xml" or "fields.xml" to be classical, just without any directory pointing.

Took me a while to find out that manually mapping \\server\c$\windows\assembly and copying the pdb to that directory mapped (z:) \gac_msil allows me to debug on the server... and found out that the default executing directory when activating a feature on site collection level through the UI, is in the inetsrv directory.

So, now I can access the feature directories through the code.
I think. I am about to test.

Oct 4, 2010 at 6:50 PM


I am trying to deploy this can you please let me know the steps we need to follow?