Пример #1
0
        private Assembly BuildAssembly(AssemblyName assemblyName, string nameSpace)
        {
            var codeProvider = CodeProvider.Default;
            var reference = new DiscoveryCompiler(_discovery, codeProvider)
                .GenerateReference(nameSpace);

            var options = new CompilerParameters(
                "System.dll System.Core.dll System.Xml.dll System.Web.Services.dll".Split(),
                assemblyName.CodeBase, true);
            var results = codeProvider.CompileAssemblyFromDom(options, reference.CodeDom);

            if (results.Errors.Count > 0)
                throw new Exception("Cannot compile service proxy: " +
                                    results.Errors[0].ErrorText + " (line " + results.Errors[0].Line + ")");

            return results.CompiledAssembly;
        }
Пример #2
0
        Assembly BuildAssembly(AssemblyName assemblyName, string nameSpace)
        {
            var codeProvider = CodeProvider.Default;
            var reference    = new DiscoveryCompiler(discovery, codeProvider)
                               .GenerateReference(nameSpace);

            var options = new CompilerParameters(
                "System.dll System.Core.dll System.Xml.dll System.Web.Services.dll".Split(),
                assemblyName.CodeBase, true);
            var results = codeProvider.CompileAssemblyFromDom(options, new[] { reference.CodeDom });

            if (results.Errors.Count > 0)
            {
                throw new Exception("Cannot compile service proxy: " +
                                    results.Errors[0].ErrorText + " (line " + results.Errors[0].Line + ")");
            }

            return(results.CompiledAssembly);
        }