?
Solved

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

Posted on 2014-11-13
8
Medium Priority
?
1,606 Views
Last Modified: 2014-11-23
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?
0
Comment
Question by:itnifl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 82

Expert Comment

by:David Johnson, CD, MVP
ID: 40439721
personally I don't like bloating the GAC and only install .dll's on an as needed basis.
0
 
LVL 2

Author Comment

by:itnifl
ID: 40441270
OK, I understand. Do you have a suggestion for a better solution for me? Would be nice to get this working :p
0
 
LVL 40
ID: 40446476
"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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 14

Expert Comment

by:CtrlAltDl
ID: 40447720
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
 
LVL 2

Author Comment

by:itnifl
ID: 40449455
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
 
LVL 2

Accepted Solution

by:
itnifl earned 0 total points
ID: 40449970
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
 
LVL 2

Author Closing Comment

by:itnifl
ID: 40460409
Gacutil.exe can be used to install dlls to the GAC, but I can't see that it has helped me.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question