VSLangProj and EnvDTE in VS 2005.

Hi,
             I am updating a existing VS 2003 add-in to VS 2005 addin. I am using the dll "VSLangProj"  assembly. But unfortunately I couldn't debug the appliction in a machine having VS 2005 (Not having VS 2003) only. I am getting a FileNotFound exception
(System.IO.FileNotFoundException: Error while loading file 'EnvDTE,
Version=7.0.3300.0). One of my project is using VSLangProj and it is dependent on 'EnvDTE, Version=7.0.3300.0. The microsoft people haven't rebuild this dll inorder to maintain backward compatibility. They are saying that we can resolve this by adding an App config file to redirect it to new dll.

http://msdn2.microsoft.com/en-us/library/ms228768.aspx

             I tried this. But my project output is class library and I am not able
to use it successfully.
            Do you have any idea about how to resolve this issue .  Is it a bug of VS 2005 The above can be run succefully in a machine having both VS 2003 and VS 2005.

Thanks!
Rathish P S.




Answer this question

VSLangProj and EnvDTE in VS 2005.

  • Muhsin Zahid U?ur

    Craig,

    Thanks for your reply.

    I am able to install it and run the application in the release mode by adding the devenv.exe.config in the installation directory. But still I am not able to debug this application in the debug mode. When I tried to VsLangProj.Reference object, I am getting the same exception. Is this config file will work only in release mode or I am doing some mistake Please help me to resolve the issue.

    Thanks!

    Rathish.



  • Radhakrishnan

    The reason this fails on a 2005 only computer is because the VS 2003 version of EnvDTE is not on the computer, and when the code that uses VSLangProj references the 2003 version EnvDTE cannot find that assembly it fails. To make this work for Add-ins, we added a binding redirect to the file devenv.exe.config. When the file cannot be found, it automatically will look for the new version because of the redirect.

    If you are running within the VS 2005 process, then you do not need to make any changes because we already have the redirect in place. But if you are trying to load your class library into a different process, then you will need to modify the config file of that process to redirect to the newer version of EnvDTE.

    Craig



  • annnot

    The resolution mentioned may solve the VSLangProj issue, but how about in general for

    1) Add-Ins that have dependent assemblies and want to use <codebase> hints for redirection

    2) Add-Ins that need configuration settings and would like to use the 2.0 framework's ConfigurationSection framework where the <configuration> section group requires an assembly name that contains the ConfigurationSection derived type.

    Fusion fails in both cases (FileNotFoundException), regardless of whether the config file is resident in the add-in or one of it's dependent assemblies, because the application base is from devenv.exe (the hosting process) -- therefore the assembly loader will ignore (not even be aware of) the <codebase> hints in the add-in configuration files, nor will it attempt to load the dependent assemblies from the directory where the add-in or it's dependent assemblies are located.

    To my knowledge, there's no way to modify where fusion looks at runtime (or is there ) How can we get around this Or is modifying devenv.exe.config the only way (aside from placing them in the GAC)

    Thanks

    RyanF



  • Ken Noland

    Chetan,

           I think you really didn't get my issue. I have an addin that is working properly in VS 2003. I have upgraded it to VS 2005 and make sufficient changes necessary to compile the application successfully. My Addin is working well in machine having both VS 2003 and VS 2005 and in VS 2005 machine. But the issue is with VSLangProj.dll, which is not rebuild by microsoft and dependent on "EnvDTE.dll of VS 2003". One of projects in the solution is using the VSLangProj.dll of microsoft and the project output is of type Class Library. In msdn, it is documented that there are some issues in using VSLangProj in VS 2005 only machine and they give a resolution to add the config file to redirect it to new EnvDTE.dll. But for class library it won't work and they haven't have posted a resolution to solve this issue. I can't even debug the application since it throws the FileNotFoundException. Is there is any other dll in VS 2005, which is equivalent to VsLangProj or any other way to resolve the issue I think you got my issue now.

    Thanks!

    Rathish P S.



  • jkhax0r

    You need the binding redirect in all programs referencing VSLangProj. If you are using a debugger other than devenv.exe, or if the binding redirect has been removed from devenv.exe.config, then you will see this message.

    Craig



  • FransRudolf

    Rathish,

    The config files work only for executables. Have you upgraded your add-in using the Project Upgrade functionality

    Can you try the creating an Add-in from scratch on the machine that has VS 2005 only. Debug this add-in. If you are able to do this then your installation is OK.

    Thanks,

    Chetan

     



  • VSLangProj and EnvDTE in VS 2005.