1
This example is from a Windows Forms project that works correctly.
namespace PriDebug_v9
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
Application.Run(new Debug());
}
public static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
string assemblyFullName;
System.Reflection.AssemblyName assemblyName;
const string PRIMAVERA_COMMON_FILES_FOLDER = "PRIMAVERA\\SG900";
assemblyName = new System.Reflection.AssemblyName(args.Name);
assemblyFullName = System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86), PRIMAVERA_COMMON_FILES_FOLDER, assemblyName.Name + ".DLL");
if (System.IO.File.Exists(assemblyFullName))
{
return System.Reflection.Assembly.LoadFile(assemblyFullName);
}
else
{
return null;
}
}
}
}
Thank you Sérgio, this particular case is for a version 9 project. I have tried it and it does not give any error. I was trying to "force" the error to be 100% sure it was all right.
– José Miguel Ferreira
Hello @Josémiguelferreira. Mark replies as useful and/or correct. See Why it is important to vote.
– João Martins