Edward Edward - 1 year ago 118
C# Question

Adding Project reference programmatically

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;

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)

but after loading the solution, BLL project didnt contain any PERMANENT reference to DAL project.

Answer Source

I think that you forget to save modified project , you have to invoke Save at the end

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download