Пример #1
0
        // If assemblyName is not fully qualified, a random matching may be
        public static String QueryAssemblyInfo(string assemblyName)
        {
            var assembyInfo = new AssemblyInfo {
                cchBuf = 512
            };

            assembyInfo.currentAssemblyPath = new String('\0', assembyInfo.cchBuf);

            IAssemblyCache assemblyCache;

            // Get IAssemblyCache pointer
            var hr = GacApi.CreateAssemblyCache(out assemblyCache, 0);

            if (hr == IntPtr.Zero)
            {
                hr = assemblyCache.QueryAssemblyInfo(1, assemblyName, ref assembyInfo);
                if (hr != IntPtr.Zero)
                {
                    Marshal.ThrowExceptionForHR(hr.ToInt32());
                }
            }
            else
            {
                Marshal.ThrowExceptionForHR(hr.ToInt32());
            }
            return(assembyInfo.currentAssemblyPath);
        }
Пример #2
0
        public AimProjectBinding()
        {
            string addInRootPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string response;
            var    exist = AssemblyExist("Aimirim.iView", out response);

            if (exist)
            {
                GacApi.RemoveAssemblyFromCache("Aimirim.iView");
            }
            GacApi.AddAssemblyToCache(Path.Combine(addInRootPath, "Aimirim.iView.dll"));
        }