Alternative to HttpUtility for .NET 3.5 SP1 client framework?

后端 未结 7 2244
温柔的废话
温柔的废话 2020-12-30 08:31

It\'d be really nice to target my Windows Forms app to the .NET 3.5 SP1 client framework. But, right now I\'m using the HttpUtility.HtmlDecode and

7条回答
  •  没有蜡笔的小新
    2020-12-30 08:44

    Apparently google couldn't find it either, so they wrote there own api-compatible version:

    Here's a workaround:

    1. Compile Google's version as a library

      wget 'http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/core/HttpUtility.cs'
      gmcs -t:library HttpUtility.cs
      
    2. Edit your-project.cs to include that namespace

      using Google.GData.Client; // where HttpUtility lives
      
    3. Recompile using the library

      gmcs your-project.cs -r:System.Web.Services -r:System.Web -r:HttpUtility
      

    From glancing at the source code, it appears that this is .NET 2.0-compatible.

    I just wrote my first hello world in csharp yesterday and I ran into this problem, so I hope this helps someone else.

提交回复
热议问题