tags:

views:

17

answers:

1

I have a ASMX web service. When I access it from a client the ASMX get compiled but I get this error:

Looking at csc.exe command line from the error detail the System.Windows.Forms asseembly is not referenced.

Compilation Error


Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)

Source Error:

Line 3:  using System.ComponentModel;
Line 4:  using System.Drawing;
Line 5:  using System.Windows.Forms;
Line 6:  using System.Xml;
Line 7:  using Idp.Core.Configuration;
A: 

This problem can occur for at least two reasons:

  1. The required assembly (in this case, System.Windows.Forms) is not referenced by your project. You can resolve this by adding the reference to your project in Visual Studio and, if required, redeploying the site.
  2. The using statement is superfluous. Sometimes I wind up with unwanted using statements in my file. If it's unused, deleting line 5 should resolve the issue.
kbrimington
System.Windows.Forms is referenced by the project and I use some classes from it.I do not understand with the reference to the assembly is not passed to the compiler
Frederic Torres
@Frederic - Is your C# code in the markup file or in a code-behind?
kbrimington
In code behind.
Frederic Torres