Iv been trying to build a new installer (MSI) for our custom webparts in VS 2010 for SharePoint 2010.
Iv come across an issue thats really driving me mad. I need to be able to update the web.cfg file on the server for where my webpart is being installed. (To be able to add safe control, etc)
When trying to use the simplest of SharePoint API classes in C#, i.e SPFarm.Local.Services. Null is always returned (Null reference exception).
Iv tried many different attempts at getting simple information from the server and all failing. (SPWebService service = SPWebService.ContentService; SPFarm mySPFarm = SPWebService.ContentService.Farm; SPApplicationPoolCollection cd = SPWebService.AdministrationService.ApplicationPools;
- ALL of these return Null/ Null reference exception)
It seems i can only get values when running code using the SharePoint classes in webparts/code thats running from within the site/application.
Can someone please give me some idea of why im unable to use any sharepoint classes outside of the SP sites/applications but on the SP server.
Alternativly, any additional ideas on ways to install custom webparts via a simple installer would be very helpfull - we need to be able to give our customers our webparts to install on their servers and make it as simple for them as possible. i.e using
a step by step installer.
View Complete Post