# Add and deploy SharePoint Farm Solutions from Document Library using C# code

I have one Document Library in central administration Name "Deployment List" it contains SharePoint Solutions(WSP files). now i want to add and deploy that solution using c# code it already get file and deploy it form Local drive but i want to get that file(WSP file from Document Library). I am using Timer job to deploy that solution Note : Solution are farm solution

my code is as follow :

try
{

Collection selectedWebApps = new Collection();

SPWebApplication webApp = SPWebApplication.Lookup(new Uri("http://localhost:80"));

solution.DeployLocal(true, true);
}
catch
{
}


Any idea how to solve this error?

• I can't see what error you mean – luccio Apr 20 '13 at 13:04
• He has it in a comment on line 3 in the code – Robert Lindgren Apr 20 '13 at 13:35

Well you didn't specify an error, but I am guessing it doesn't know what you are talking about when you give it that url.

When you deploy to SharePoint it expects a physical file in a physical location.

I had a similar problem trying to parse the contents of .doc files from the old 2003 Office library.

We ended up downloading the file to the filesystem, processing it, then deleting it from the filesystem. The same would work here and you would maintain the transparency you are looking for.