コード例 #1
0
ファイル: ProjectValidator.cs プロジェクト: kain64/wixsharp
        public string OriginalAssemblyFile(string file)
        {
            string dir = IO.Path.GetDirectoryName(IO.Path.GetFullPath(file));

            System.Reflection.Assembly asm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a =>
            {
                try
                {
                    return(a.Location.SamePathAs(file)); //some domain assemblies may throw when accessing .Locatioon
                }
                catch
                {
                    return(false);
                }
            });

            if (asm == null)
            {
                asm = System.Reflection.Assembly.ReflectionOnlyLoadFrom(file);
            }

            // for example 'setup.cs.dll' vs 'setup.cs.compiled'
            var name = asm.ManifestModule.ScopeName;

            return(IO.Path.Combine(dir, name));
        }
コード例 #2
0
ファイル: ProjectValidator.cs プロジェクト: alxcp/wixsharp
        public string OriginalAssemblyFile(string file)
        {
            string dir = IO.Path.GetDirectoryName(IO.Path.GetFullPath(file));

            System.Reflection.Assembly asm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a =>
            {
                try
                {
                    return(a.Location.SamePathAs(file)); //some domain assemblies may throw when accessing .Locatioon
                }
                catch
                {
                    return(false);
                }
            });

            if (asm == null)
            {
                asm = System.Reflection.Assembly.ReflectionOnlyLoadFrom(file);
            }

            var name = asm.ManifestModule.ScopeName;

            if (Path.GetExtension(name) != Path.GetExtension(file))
            {
                name = Path.GetFileNameWithoutExtension(name) + Path.GetExtension(file);
            }

            return(IO.Path.Combine(dir, name));
        }