I had cause the other day to use ILMerge to combine several DLLs. The first issue I came across was:
Unresolved assembly reference not allowed: System.Core.
This is mentioned in several blogs and the solution suggested was to use the /lib switch and specify the path to the .NET library you want for the target. In my case I wanted to target 4.5.2 so I used the following which supposedly worked (the blog said)
ilmerge /lib:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2" /out:MERGED.First.dll First.dll Second.dll /keyfile:key.snk
Note that if you strongly signed your First DLL don't assume the output will be strongly signed because it won't be. You have to add the /keyfile option to do that.
Note also there are blogs that say don't try and point to C:\Windows... because that is not the correct location. You need to use the Reference Assemblies path given above.
Well I didn't get the error and ILMerge started off and I waited. And waited. And waited. So basically ILMerge just hangs still consuming by the way 50% CPU just to fool you into thinking its actually doing something.
Its the wrong syntax. The correct syntax uses /targetplatform not /lib
ilmerge /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2" /out:MERGED.First.dll First.dll Second.dll /keyfile:key.snk
Sunday, November 29, 2015
Creating a SharePoint OnLine Folder using CSOM
Surprisingly I can't find a complete solution to this on the blogosphere. So let me put that right.
First add two references to
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.RunTime.dll
I found them on my 64-bit server located here
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI
In your code add a using statement
using Microsoft.SharePoint.Client;
Then in your method add the following
using (ClientContext ctx = new ClientContext(site))
{var securePassword = new SecureString();
foreach (char c in password)
{
securePassword.AppendChar(c);
}
ctx.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(username, securePassword);
var list = ctx.Web.Lists.GetByTitle(doclib);
var folderRoot = list.RootFolder;
ctx.Load(folderRoot);
ctx.ExecuteQuery();folderRoot = folderRoot.Folders.Add(folder);
ctx.ExecuteQuery();
};
First add two references to
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.RunTime.dll
I found them on my 64-bit server located here
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI
In your code add a using statement
using Microsoft.SharePoint.Client;
Then in your method add the following
using (ClientContext ctx = new ClientContext(site))
{var securePassword = new SecureString();
foreach (char c in password)
{
securePassword.AppendChar(c);
}
ctx.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(username, securePassword);
var list = ctx.Web.Lists.GetByTitle(doclib);
var folderRoot = list.RootFolder;
ctx.Load(folderRoot);
ctx.ExecuteQuery();folderRoot = folderRoot.Folders.Add(folder);
ctx.ExecuteQuery();
};
Subscribe to:
Posts (Atom)