Terry
Member
- Joined
- Aug 19, 2014
- Messages
- 13
- Programming Experience
- 3-5
I have a large project which has reference to a DLL which is compiled programmatically from within the main project. The DLL is created from a user modified file and is therefore deliberately changing prior to the execution of the main application. Whilst the compilation is working fine using the VBCodeProvider class I cannot figure out how to refresh the reference programmatically once the new assembly (DLL) has been created. I have been following solutions along the lines of the DTE class but am consistently getting different types of error using the Microsoft Example for referencing the DTE object:
' Get an instance of the currently running Visual Studio .NET IDE.
Dim DTE as EnvDTE.DTE
DTE = System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE")
The above code gives me the following error:
System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
I have also tried a code snippet for Listing the references at the following link:
Refreshing project references with a Macro - CodeProject
But this also yields error in retrieving the DTE object.
Is there an easier way to refresh a reference DLL programatically? Or alternatively, if I am going in the right direction can someone tell me how to retrieve the DTE object and then the subsequent code to access the reference object to refresh.
Hope all is this is clear...
Thanks
' Get an instance of the currently running Visual Studio .NET IDE.
Dim DTE as EnvDTE.DTE
DTE = System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE")
The above code gives me the following error:
System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
I have also tried a code snippet for Listing the references at the following link:
Refreshing project references with a Macro - CodeProject
But this also yields error in retrieving the DTE object.
Is there an easier way to refresh a reference DLL programatically? Or alternatively, if I am going in the right direction can someone tell me how to retrieve the DTE object and then the subsequent code to access the reference object to refresh.
Hope all is this is clear...
Thanks