我有一个解决方案,其中包含三个动态创建的项目。现在我需要将第一个项目的引用添加到第二个和第三个项目中。当我尝试这个逻辑时,我能够单独构建项目,但是在构建解决方案时,它会抛出"Reference could not be loaded properly"
错误。这是直接使用theVSProject.References.Add()
方法添加.dll
时发生的。
所以我尝试使用下面的代码作为解决方案,但仍然遇到一些错误。
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 referenced assembly 'EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be found.
有解决方案吗?
我们没有权限访问 VS IDE
文件夹来应用以下修复方法。
注意: 我们也尝试了以下应用于 App.Config
的解决方案,但问题仍然存在。