locked
Display the sharepoint site data using ASP.NET MVC 2.0 RRS feed

  • Question

  • I have sharepoint 2007 site running i want to display few document in the mobile website so i am using Asp.Net MVC 2.0 for that but when i add the sharepoint reference dll in the MVC 2.0 project i get the error that

    "Could not load file or assembly 'Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. An attempt was made to load a program with an incorrect format."

     So its possible to used MVC 2.0 for retrieving sharepoint 2007 site data.


    Friday, February 18, 2011 7:16 AM

Answers

All replies

  • Hi Bhavik,

    Go to the bin folder of your project and delete / renmae following files

    Microsoft.SharePoint.Search.dll and Microsoft.SharePoint.Search.xml

    every time you build your solution, Microsoft.SharePoint.Search.dll and Microsoft.SharePoint.Search.xml are added to the build folder, so don't forget to delete them after every build

    Hope this helps


    Regards, Pratik Vyas | SharePoint Consultant | http://sharepointpratik.blogspot.com/
    Friday, February 18, 2011 7:41 AM
  • Thanks

    I got another solution. i have added the following script in the programmer property--> Build Event --> post-build event command line

    i have wrote following script

    cd$(OutDir)
    del Microsoft.Office.Server.Search.dll
    del Microsoft.Sharepoint

    so it solved the problem.

     

    but when i created a class library and write a code to retrieve the data from the sharepoint and added the dll in the mvc project call the method from the mvc project it is showing me error that

    "

    The Web application at http://abc:1234 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

    i am not getting what to do.

     

    Friday, February 18, 2011 11:32 AM
  • Hi,

    Thanks to share your post.

    For the issue, do you mean that the error happens when you added the dll in the MVC project?  If yes, it should be the error URL or the wrong configuration. Fortunately, a former user Ramnadh has account the same problem, and he resolved it:

    http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/a732cb83-c2ef-4133-b04e-86477b72bbe3.

    Hope this could help you!

    Leo

    • Marked as answer by Emir Liu Monday, March 7, 2011 7:19 AM
    Monday, February 28, 2011 9:13 AM