Using VB Linq in web applications

How can I use VB linq in a web application

I saw a thread with a hack telling to change a csproj file (in c#), but I created a new website and there is no vbproj file for the application. Is there some way to make visual studio use the prototype compiler for VB 9.0 in web applications



Answer this question

Using VB Linq in web applications

  • Jonathas Oliveira

    Ok, I finally made LINQ work in a web project. Here are the detailed step by step instructions:

    How To: Use the "Visual Basic 9.0 LINQ Technology Preview" in Web projects

    1. Download and install the "Visual Basic 9.0 LINQ Technology Preview" from the Downloads section at http://msdn.microsoft.com/vbasic/Future/default.aspx
    2. Download and install "Visual Studio 2005 Web Application Projects" at
      http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/
    3. Start Visual Studio 2005 and create a "New Project" (NOT a New Website). In project templates, select "ASP.NET Application", type a name for the project and click OK.
    4. Close Visual Studio 2005.
    5. In Windows Explorer, go to the newly created project folder (tipically in My Documents/Visual Studio 2005/Projects/ProjectName/) and open the .vbproj file using notepad.
    6. Replace the following line:
      <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
      with:
      <Import Project="$(ProgramFiles)\VB LINQ Preview\Bin\Microsoft.VisualBasic.LINQ.targets" />
    7. Open your project with Visual Studio 2005 and double click on My Project in the Solution Explorer.
    8. In the References tab add click on the "add..." button, select the "Browse" tab and browse to "c:/Program Files/VB LINQ Preview/Bin/". Add references to the following libraries:
      - System.Query.dll
      - System.Data.DLinq.dll
      - System.Xml.XLINQ.dll
    9. In the Imported Namespaces listbox select the following:
      - System.Data.DLinq
      - System.Query
      - System.Xml
      - System.Xml.XLinq
    10. In the Imported Namespaces textbox type "System.Query.Sequence" (without the quotes) and then click on the "Add User Import" button.

    Now your project is VISUAL BASIC 9.0 LINQ enabled!


  • locknload

    Same problem , this fix worked .

    Again , I nver install VB but do install C++.

    Regards,

    Ben


  • sameerTripathi

    That's a new-style web project. The thread you refer to is talking about modifying an old-style web project. I recommend you take a closer look at the links Fabrice provides, to create an old-style project. That should give you the proj file to modify.

    Sorry for the confusion.



  • Marco72463

    Hi Hector

    I did not understand or see Imported Namespaces listbox or text. Could you please provide me little more details of steps 9 and 10.

    Thanks in advance.



  • Fakhar Khan

    Rama.NET:

    In Visual Studio 2005, select the project menu and then the last menu item called "ProjectName" properties... Then select the References tab and there should it be the Imported Namespaces textbox and listbox I refered to.


  • GreyGallon

    Another sugestion for VB programmers:

    How To: Create a User Project Template for LINQ Web Applications

    1. Create a new project of type "ASP.NET application" as indicated on step 3 of previous message, call it "LINQWebApplication"
    2. Do steps 4 to 10 of previous message.
    3. With the project opened in Visual Studio 2005, in the File menu, select "Export Template..."
    4. Select "Project Template" option, then click the Next> button
    5. Type "LINQ Web Application" in the Template Name textbox
    6. Type "A project for creating an application with a Web user interface using LINQ." in the Template Description textbox.
    7. Keep other defaults and click on the Finish button
    8. Using Windows Explorer, open the folder My Documents/Visual Studio 2005/Templates/Project Templates/
    9. Move the file "LINQ Web Application.zip" to the Visual Basic subfolder

    Now you have a user project template for Visual Studio 2005 for instant coding using VB 9.0 and *LINQ.

    Now, to create a new LINQ enabled web application using the user project template:

    1. In the File menu, select "New project..."
    2. Select the Visual Basic node in the left treeview, and scroll down in the templates listview until you see the MyTemplates section.
    3. Select LINQ Web Application

    Hope this helps :-)


  • Andrej

    Are you using the default web site project (app_code, etc), or are you using the 1.x-style Web Application project template that Fabrice provides links to in that thread



  • Juan Pablo Gil

    Hector

    Thank you very much for that hint. I was actually looking at C# -- ASP.NET application Project Properties. My bad, I didn't realize that that hint was for Visual Basic .NET. I appreciate your help with creating the template for VB.NET Web Projects using LINQ :-). That really helps.

     



  • Robert Belka

    I am using the default web site project


  • Using VB Linq in web applications