Question

I wrote a simple web service in C# using SharpDevelop (which I just got and I love).

The client wanted it in VB, and fortunately there's a Convert To VB.NET feature. It's great. Translated all the code, and it builds. (I've been a "Notepad" guy for a long time, so I may seem a little old-fashioned.)

But I get this error when I try to load the service now.

Parser Error Message: Could not load type 'flightinfo.Soap' from assembly 'flightinfo'.

Source Error:

Line 1:  <%@ WebService Class="flightinfo.Soap,flightinfo" %>

I have deleted the bins and rebuilt, and I have searched google (and stackoverflow). I have scoured the project files for any remnants of C#.

Any ideas?

Was it helpful?

Solution

In VB.NET, namespace declarations are relative to the default namespace of the project. So if the default namespace for the project is set to X.Y, everithyng between Namespace Z and End Namespace will be in the X.Y.Z namespace. In C# you have to provide the full namespace name, regardless of the default namespace of the project. So if the C# project had the default namespace X.Y, the CS files would still include the namespace X.Y declaration. After converting to VB, if both the default namespace and the namespace declarations in the files stay the same you end up with classes in the X.Y.X.Y namespace. So in your case, the Soap class is now in the flightinfo.flightinfo namespace. Thus there are three possible solutions:

  • change the asmx file to

  • remove the default namespace from the project

  • remove the namespace declarations from the vb files

OTHER TIPS

<%@ WebService Class="flightinfo.Soap,flightinfo" %>

What is the name of your class?

The problem may be cause by VB.NET & C# projects using different naming conventions for project assemblies and how the project namespace is used. At least that's were I would start looking.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top