Reputation: 15253
Currently I have a custom Web Part, deployed as a Feature, and it accesses an XML file as follows:
string sUri = @"C:\inetpub\wwwroot\wss\VirtualDirectories\80" + @"\wpresources\links.xml";
ds = new DataSet(); ds.ReadXml(sUri);
What is the correct way to include an XML file as part of a SharePoint Feature deployment?
Upvotes: 1
Views: 286
Reputation: 2172
In my mind there are a few correct ways. The place you want to deploy your xml file I would not pick however.
It would have to be either:
To my knowledge there is no simple way of deploying files to the InetPub folder for your website. I needed this once to deploy a .browser file and ended up creating a feature receiver that copied the file from the 12-hive into the InetPub folder.
Maybe if you explain what the xml file is for, the answers can be better :)
Upvotes: 1
Reputation: 14295
Load it into the 12 hive under your layouts directory and link to it via
http://[currentsite]/[currentweb]/_layouts/links.xml
. Or add a subdirectory to group all of your file together. e.g.
http://[currentsite]/[currentweb]/[myFeature]/_layouts/links.xml
how do I include it in the Feature project...?
I am using STSDEV and that automagically puts an entry into the manifest.xml under
<Templates>
e.g.
<TemplateFile Location="LAYOUTS\[myFeature]\links.xml" />
Upvotes: 1