cs部分内容为:namespace Ky.BLL
{
using Microsoft.CSharp;
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Web.Services.Description; public class WebServiceHelper
{ ……………… CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
codeCompileUnit.Namespaces.Add(namespace2);
importer.Import(namespace2, codeCompileUnit);
ICodeCompiler compiler = new CSharpCodeProvider().CreateCompiler();
CompilerParameters options = new CompilerParameters();
options.GenerateExecutable = false;
options.GenerateInMemory = true;
options.ReferencedAssemblies.Add("System.dll");
options.ReferencedAssemblies.Add("System.XML.dll");
options.ReferencedAssemblies.Add("System.Web.Services.dll");
options.ReferencedAssemblies.Add("System.Data.dll");
CompilerResults results = compiler.CompileAssemblyFromDom(options, codeCompileUnit); ………… }用2.0编译时出现如下错误:(web 类 C#)
WebServiceHelper.cs(43,42): 警告 CS0618: “System.CodeDom.Compiler.CodeDomProvider.CreateCompiler()”已过时:“Callers should not use the ICodeCompiler interface and should instead use the methods directly on the CodeDomProvider class. Those inheriting from CodeDomProvider must still implement this interface, and should exclude this warning or also obsolete this method.”具体该如何解决修改呢??
解决方案 »
- 一个T-SQL 截取字符串的问题
- 如何编程替换文件夹中的word文档中的文字和图标
- asp.net如何做显示上传图片的页面
- 菜鸟问题(编译器错误信息: CS1519: 类、结构或接口成员声明中的标记“(”无效)!求救
- asp.net中调用了打印机进行打印,如何指定打印的内容,而非整个页面?
- 急求一access中模糊查询的sql语句 在线等1
- 怎么将两个数据库合并
- 高分讨论,承认是.NET高手的进来,up者有分
- 关于分页存储过程的问题(Procedure expects parameter '@parameters' of type 'ntext/nchar/nvarchar'.)
- 关于WebControl的TreeView控件的高级问题!!!
- 哪位大侠能给个新闻图片切换的flash或代码啊?
- Nhibernate 查询后获得结果速度很慢
如果不想出现警告,在你的代码的基础上,可改为:
CodeDomProvider provider = CodeDomProvider.CreateProvider("C#");
CodeCompileUnit[] ccus = new CodeCompileUnit[1];
ccus[0] = codeCompileUnit;
CompilerResults results = provider.CompileAssemblyFromDom(options, ccus);