Excuse the title, but it’s best I just explain the problem.
I have 2 projects in my solution
- A Class Library
- A Web Application, which consists of a web service (asmx).
the web service has code sitting in the app_code folder, with a file [webservicename].cs
Inside the webservice code behind class, I have a web method here is a sample example (its simplified):
[WebMethod]
public EnumTaskExportState ProcessTask()
{
var tm = new UploadTaskManager();
return tm.ProcessTask();
}
Now at design time, in visual studio (2010 or 2008), when I right click on UploadTaskMananger, and then select “Go to definition”. I get taken to AppData\Temp[some folder structure]…etc…. and it displays the public class definition.
Instead I would like to have complete integration, so that I get taken directly to the actual class in the class library project.
My guess is, this is happening because I am using the app_code route, and not a compiled file for the web service class. But I don’t know any other way to do this.
How can I fix this? Possibly do away with the need for the app_code directory?
Its pretty easy
Step 1… when you generate a new web service , the app_code/.cs file gets generated too.
Copy the signature from that class, it will be used as a template in step 4.
Step 2… delete the app_code/.cs file that got generated
Step 3. In your class file, create a namespace and folder structure where you will include the web service classes containing web methods. For example Class1.WebServices
Step 4. in Namespace Class1.WebServices (as per above example), create a new class, then replace the default class signature with the copied class signature from step 1.
Step 5. Edit the web service now, and create your web methods
Step 6. In the web application, edit the asmx file to reference the class without code behind for example
Step 7, test!