Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++/CLI
Hi all, I need to ensure that in case the assembly/dll qualifies all prerequisite for Installation in GAC path viz., Strong name, Signing etc., this should install assembly/dll in GAC path ie., ("C:\Windows\Microsoft.NET\Assembly\abc.dll")
#include <stdafx.h>
#include <windows.h>
....
...
#using <mscorlib.dll>
using namespace System;
using namespace System::EnterpriseServices::Internal;
 
//Adding Reference to the above in the project

bool InstallABC() {
   try {
 
        System::EnterpriseServices::Internal::Publish ^ pb = System::EnterpriseServices:;Internal::Publish();
 
     pb->GacInstall(@"C:\Abc.dll");
 
    } catch(SecurityException & ex) {
        return false;
    }
    return true;
 
}
if not it should display a message box, of Unsuccessfull in Installing the Assembly/dll in the GAC path, Since, I am writing this code as managed (C++/CLI extensions) within Unmanaged C++, I want to handle the Exception without allowing calling OS terminate/abort process,
could you share me some examples on managed(C++/CLI) specific to the above GACInstall(..) API.
 
Also, in exception handling does above code sufficient to capture the Unhandled Exception due to failure on part of Dll/Assembly to be placed in GAC.
 
Any Help in resolving the above would be much appreciable,
 
Details:
 
VS2008 IDE , Windows 7 o/s, Usage of GACInstall(..) programmatically,
 
Regards,
 
VishalK_90
Posted 15-May-13 5:54am
Edited 15-May-13 5:55am
v2
Comments
Sergey Alexandrovich Kryukov at 15-May-13 11:02am
   
Not clear: how can it be a problem? For goodness sake, handle the exception exactly the way you want, what can prevent your from doing that?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 406
1 /\jmot 180
2 Suraj Sahoo | Coding Passion 170
3 Afzaal Ahmad Zeeshan 159
4 BillWoodruff 154
0 OriginalGriff 8,344
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,634
3 Maciej Los 5,024
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 15 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100