Я пытаюсь использовать OpenPop.NET для доступа к учетной записи gmail, однако я получая сообщение об ошибке ниже даже с базовым кодом тестирования.C#: Не удалось загрузить файл или сборку 'OpenPop, Version = 2.0.4.369, Culture = neutral, PublicKeyToken = null' или одна из его зависимостей
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'OpenPop, Version=2.0.4.369, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'OpenPop, Version=2.0.4.369, Culture=neutral, PublicKeyToken=null' at ST_1694f4bcdf2a4068ae871201a2216457.csproj.ScriptMain.Main()
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Я пытаюсь сделать это в пакете служб SSIS в SQL Server Business Intelligence Development Studio 2008 на Windows 7 машины с платформой .NET 3.5 и 4. Обе библиотекой DLL OpenPop и задачей сценария, ссылающаяся его строятся в 3.5. Я исследовал это несколько дней, но не смог найти ничего, что могло бы исправить это. Я попытался перекомпилировать DLL OpenPop из исходного кода и удалить и повторно добавить ссылку несколько раз.
Код Сейчас я работаю с размещена ниже:
Pop3Client client = new Pop3Client();
try
{
client.Connect("pop.gmail.com", 995, true);
try
{
client.Authenticate("[email protected]", "mypassword");
Console.WriteLine("Success");
client.Disconnect();
}
catch
{
Console.WriteLine("Failed to authenticate");
Dts.TaskResult = (int)ScriptResults.Failure;
return;
}
}
catch
{
Console.WriteLine("Failed to connect");
Dts.TaskResult = (int)ScriptResults.Failure;
return;
}
Dts.TaskResult = (int)ScriptResults.Success;
Спасибо заранее.
Примечание: Gacutil.exe только для развития и не должны использоваться для установки производственных сборок в глобальный кеш сборки. – toha