How do I Install a .net 4.5 dll in GAC?

I have created an integration pack with C# for System Center Orchestrator 2012 that runs on Windows Server 2012 R2 that depends on Newtonsoft.Json which is in Newtonsoft.Json.dll. When I run the runbook I get:

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

Exception: FileNotFoundException
Target site: LogIn.Execute

Stack trace:
   at MyClient.LogIn.Execute(IActivityRequest request, IActivityResponse response)

I first thought I could use Ilmerge to merge the dependent dlls together, and I used this guide to set this up automatically when compiling in Visual Studio 2013: http://www.hanselman.com/blog/MixingLanguagesInASingleAssemblyInVisualStudioSeamlesslyWithILMergeAndMSBuild.aspx

But when doing this, and including both the required dll and dependent projects for the merging - the compile and merge takes for ever. The reason is that several sub-projects use .net and all those dependencies need to be merged as well - which is alot.

So then I thought I might want to install the required dll into the GAC. I found http://camerondwyer.wordpress.com/2013/05/22/how-to-install-a-dll-to-the-gac-on-windows-2012-using-only-powershell-without-having-to-install-sdk-or-visual-studio/, but this installs into the .net 4 part of the gac I suppose, because it didn't fix my problem and the dll is compiled for .net 4.5 of what I can see.

The options I have is to be able to ilmerge without merging the whole .net or install the dll on the Orchestrator runbook server so that my integration pack can use it. Any suggestions?
LVL 2
itniflAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
personally I don't like bloating the GAC and only install .dll's on an as needed basis.
0
itniflAuthor Commented:
OK, I understand. Do you have a suggestion for a better solution for me? Would be nice to get this working :p
0
Jacques Bourgeois (James Burger)PresidentCommented:
"Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0"

Unless there is a coincidence in the version numbers, you need the Framework 4.5 installed on that computer. Installing only one dll from the framework will not be enough.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

CtrlAltDlCommented:
Unfortunately Jacques is right, you will need to install .net Framework 4.5 on that computer.  Is there reason you can't do that?  Is it a shared hosting server or something?  IT admin won't allow it to be installed?

https://support.microsoft.com/kb/324733
"You cannot include the .NET Framework in a Windows Installer setup package that you create by using Microsoft Visual Studio .NET deployment tools. The .NET Framework must be installed separately."
0
itniflAuthor Commented:
Hello and thank you for your reply. I think you guys are mistaking. Net 4.5 is installed on the server where this is running: .Net 4.5 is installed
It isn't the framework that is missing, but Newtonsoft.Json that is missing. Newtonsoft.Json is not a part of .Net 4.5, but uses it as far as I know.

My Integration Pack uses Newtonsoft.Json which is added to my Visual Studio project using NuGet. It compiles into Newtonsoft.Json.dll which in <my project>\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll and <my project>\bin\Debug\Newtonsoft.Json.dll:
Overview
When using ILmerge to merge all dll's at compile time, the command looks like this:
"C:\Program Files (x86)\Microsoft\Ilmerge\Ilmerge.exe" 	/out:
	"C:\Users\username\Documents\stash_prosjekter\SCO Integration Packs\myProject\bin\Debug\myProject.dll" 
	"C:\Users\username\Documents\stash_prosjekter\SCO Integration Packs\myProject\obj\Debug\myProject.dll" 
	"C:\Users\username\Documents\stash_prosjekter\SCO Integration Packs\myProject\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll" 
	"C:\Users\username\Documents\stash_prosjekter\Models\API\models\bin\Debug\models.dll" 
	"C:\Users\username\Documents\stash_prosjekter\WebRequestor\bin\Debug\webrequestor.dll"

Open in new window


The strange thing is that when I create the integration pack or oip file with  Orchestrator Integration Pack Wizard, I have chosen to include Newtonsoft.Json.dll as a dependency. This should be enough so that the Integration Pack would have access to the file to use the code there, but this time it seems not to be ok.

Looks like the integration packs get installed here:
C:\Program Files (x86)\Common Files\Microsoft System Center 2012\Orchestrator\Extensions\Support\Integration Toolkit, my particular integration pack is here: C:\Program Files (x86)\Common Files\Microsoft System Center 2012\Orchestrator\Extensions\Support\Integration Toolkit\f3533bfa-e025-4189-a5c2-a7164d5083c0, and all the dlls are there - even Newtonsoft.Json.dll. So all should be ok, but it is not...
0
itniflAuthor Commented:
The answer to my initial question is to use gacutil.exe to install the dll, but after doing this I still have the same problem as described above.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
itniflAuthor Commented:
Gacutil.exe can be used to install dlls to the GAC, but I can't see that it has helped me.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.