Friday, November 26, 2010

Add web reference to a console application in visual studio

This is somewhat confusion to many people. We can add a service reference to console application, but when you right click on project, you didn't see a direct "Add Web Reference" option. But, there are so many requirements we have to add a web reference. So, I thought of posting it in my blog.
Solution:
  1. Create a console application using visual studio.
  2. Right click on the project and click on "Add Service Reference...".
  3. On the window, you will find the "Advanced" button at the bottom. 
  4. Click on the button and it will open service reference settings window. It has a button at bottom called "Add Web Reference".
  5. Click on it and add web reference as shown below.
That's it. We are done!!!

11 comments:

  1. Praveen, thanks for this post. I didn't have time to dig into why I couldn't add a web ref to a console app I needed to bang out quickly. This post was a life-saver!

    ReplyDelete
  2. Thanks Praveen! This post saved me from having to dig through lots of options.

    ReplyDelete
  3. When I click on "Advanced", it gives me an error "Could not load file or assembly 'VsWebSite.Interop, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.".

    Can you please help me in this? This happens in VS 2010, Console App, framework 4.0, 3.5

    ReplyDelete
  4. Thanks... I believe you just saved me a few hours :)

    ReplyDelete
  5. Thanks ..! I across the website without solution, but this simple solution aewsome & helps me a lot

    ReplyDelete
  6. Thanks its working fine

    ReplyDelete
  7. Thank you Praveen, it's working great !

    ReplyDelete
  8. My "Add web reference" option doesn't exist, help!

    ReplyDelete
  9. Thanks...very helpful.

    ReplyDelete
  10. Thank you..it was very helpful.

    ReplyDelete
  11. Thanks it was very helpful.

    ReplyDelete