添加项目引用编程 [英] Adding Project reference programatically
本文介绍了添加项目引用编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上,读了几个链接之后,我试图在上面的代码:
Basically, after read a couple links, i tried the above code:
foreach (EnvDTE.Project proj in soln.Projects)
{
if (proj.Name == "BLL")
{
VSLangProj.VSProject vsproj = (VSLangProj.VSProject)proj.Object;
vsproj.References.Add(@"C:\Teste\DAL\bin\Debug\DAL.dll");
}
}
所有路径,项目名称,是硬编码上。purpouse,因为即时通讯仍在测试该如何实现呢
All paths, project names, are hard-coded on purpouse, since im still testing how to achieve it.
虽然它会像如果我没有
项目文件夹 - >引用 - >添加引用 - >选择之一,手动(编译时间)
Though it would act like if i did Project folder -> References -> Add reference -> Pick one, manually (compile time)
但装载的解决方案,BLL项目剪掉含有任何永久性参考DAL项目后。
but after loading the solution, BLL project didnt contain any PERMANENT reference to DAL project.
我想什么家伙?
非常感谢!
What am i missing guys? Thanks a lot!
推荐答案
我想你忘记保存修改的项目,你必须在调用保存结束
I think that you forget to save modified project , you have to invoke Save at the end
这篇关于添加项目引用编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文