Our Scenario is We are building VS 2010 Setup Installer (Setup and Deployment project ) which install Visual studio custom project templates , some add in and our code -custom dll in GAC and artifacts for add ins .
Till now we were using .net frame work-4.0 dlls to build our software , so pre requisite would be present in customer in client computer as part of net frame work 4 . Despite of the tradeoffs of putting in GAC , we have been adding our custom dll in GAC, (Installer project – File system Editor- Our Project output to GAC) and everything is working.
Recently we started using Newtonsoft , Active Directory Authentication Library for our new requirement
Since Microsoft does not provide anything for distributing our DLLs outside of the NuGet gallery, seeking your advice on Windows Installer / Builders to redistribute the dll Newtonsoft , Active Directory Authentication Library in client computer
Options
Approach 1) : Make this open source dlls as pre requisites : As part of customer instruction manual for our software – we can include nuget package commands of open source dlls -Newtonsoft , Active Directory Authentication Library
However customers are free to download the package, unpack it and GAC the individual DLLs in assembly and we also would like to validates pre requisite exist or not client compute by writing below code
Question 1) Is this best approach to follow ?
Question 2) If yes , what would be the best approach to determines whether assembly exist from below code ,,any other best ways .
/// <summary>
/// Does AssemblyExist
/// </summary>
/// <param name="assmblyName">Assmbly FullName</param>
/// <returns></returns>
public static bool DoesAssemblyExist(string assemblyFullName)
{
bool isExist = false;
//LoadWithPartialName is Deprecated
//Assembly currentAssmbly = Assembly.LoadWithPartialName(assmblyName);
try
{
string assmblyName = "newtonsoft.json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL";
// Approach-1
Assembly currentAssmbly = Assembly.Load(assemblyFullName);
if (currentAssmbly != null)
{
isExist = true;
}
// Approach-2
//or
isExist = Assembly.ReflectionOnlyLoad(assemblyFullName).GlobalAssemblyCache;
//or
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
// Approach-3
var assembly = (from a in assemblies
where a.FullName == assmblyName
select a).SingleOrDefault();
if (currentAssmbly != null)
{
isExist = true;
}
}
catch (Exception)
{
//Log
}
return isExist;
}
Approach 2) : GAC this dll from our installer (Right click - Set up and Deployment project - File system Editor- Configure to GAC this dlls )
Approach 3) : I am not sure we can configure VS2010 Setup & Deployment Project: to put DLLs into /bin folder because we have 7 class library (c#) project output dll which we are adding to GAC from Setup & Deployment project and waiting for the approach on Newtonsoft , Active Directory Authentication Library
https://social.msdn.microsoft.com/Forums/windows/en-US/7b5d12ff-1570-47c2-8f89-7c58422332c8/vs2010-setup-deployment-project-how-to-put-dlls-into-bin-folder?forum=winformssetup&prof=requiredBest Regards Showkath