I have a solution and three projects inside that which is all created dynamically. Now I have to add the first project's reference to the second and third one. When i tried the logic i'm able to build the project individually and when building the solution it throws me the "Reference could not be loaded properly"
error. This happens when the .dll
is added directly using theVSProject.References.Add()
method.
So i tried of using the below code to which is posted as a solution to the above issue. But still i'm getting some error.
Imports VSLangProj
' Add the second project as a reference to the first project.
Sub AddProjectExample()
' First project is a Visual Basic or C# project.
Dim theVSProject As VSProject = _
CType(DTE.Solution.Projects.Item(1).Object, VSProject)
' Second project is any type of project.
Dim secondProject As Project = DTE.Solution.Projects.Item(2)
' AddProject returns the newly created Reference object.
Dim newReference As Reference
newReference = theVSProject.References.AddProject(secondProject)
End Sub
The error is,
The referenced assembly 'EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be found.
Any solution for this?
We don't have permission for VS IDE
folder for applying the below fix.
Note: Have also tried the below solution for application App.Config
but still there is issue.