Имею собственное приложение, для которого при установке одна dll-ка помещается в GAC.
Делаю это с помощью собственной программки примерно так
Publish publish = new Publish();
if (String.Compare(args[0], "install") == 0) {
publish.GacInstall (args[1]);
Но почему-то пару дней назад такой способ перестал работать —
выдает
Installation in the global assembly cache failed: GACClass.dll
(смотреть это надо в EventViewer -> Warnings -> COM+ SOAP Services).
Никакой другой информации нет, поэтому причину понять невозможно.
Более подробно, мой тест выглядит так:
1. Создаю dll-ку:
using System;
public class GACClass {
public static int function_1 ( int x ) {
return ( x + 1 );
}
}
посредством
>csc /t:library /out:GACClass.dll GACClass.cs
Для установки в GAC, использую код:
using System;
using System.EnterpriseServices.Internal;
using System.IO;
using System.Security;
namespace GacInstall
{
class CGacInstall
{
public static void Main(string[] args)
{
if (args.Length != 2) {
Console.WriteLine("GacInstall 1.0");
Console.WriteLine("");
Console.WriteLine(" Copyright 2004-2005 - All rights reserved");
Console.WriteLine(" Written by Filippo Toso (http://www.humanprofile.biz/)");
Console.WriteLine("");
Console.WriteLine("The syntax of this tool is:");
Console.WriteLine("");
Console.WriteLine("For install your helloworld.dll into GAC type:");
Console.WriteLine("");
Console.WriteLine(" gacinstall install helloworld.dll");
Console.WriteLine("");
Console.WriteLine("For remove your helloworld.dll from GAC type:");
Console.WriteLine("");
Console.WriteLine(" gacinstall remove helloworld.dll");
Console.WriteLine("");
Console.WriteLine("Exit codes:");
Console.WriteLine("");
Console.WriteLine("0 - No error, Successful operation");
Console.WriteLine("1 - Invalid params number, showing this help");
Console.WriteLine("2 - File in argument 1 doesn't exists");
Console.WriteLine("3 - Invalid argument 0 (must be \"install\" or \"remove\")");
Console.WriteLine("4 - Exception raised by the publish class method invocation");
System.Environment.ExitCode = 1;
return;
}
if (!File.Exists(args[1])) {
System.Environment.ExitCode = 2;
return;
}
Publish publish = new Publish();
try {
if (String.Compare(args[0], "install") == 0) {
publish.GacInstall (args[1]);
} else if (String.Compare(args[0], "remove") == 0) {
publish.GacRemove (args[1]);
} else {
System.Environment.ExitCode = 3;
return;
}
}
catch {
System.Environment.ExitCode = 4;
return;
}
System.Environment.ExitCode = 0;
}
}
}
После его трансляции, запускаю его как
>>GacInstall.exe install GACClass.dll
Отрабатывает без сообщений, dll-ки в GAC не появляется, cообщение в Event Viewer'е имеет вид:
Log Name: Application
Source: COM+ SOAP Services
Date: 17.04.2012 16:22:22
Event ID: 0
Task Category: None
Level: Warning
Keywords: Classic
User: N/A
Computer: s
Description:
Installation in the global assembly cache failed: GACClass.dll
В чем может быть причина ? Операционная система — Windows 7 Enterprise.
Попробовал подписывать dll-ку c помощью "strong name" (хотя раньше этого не делал и всё было хорошо),
но это ничего не дало — проблема та же ...
Please, help, кто в курсе ...
Юрий