Dynammically adding project references into the webproject.

A

Anubhav Jain

Hi,

I am creating a visual studio template in VS.Net 2005. It contains
webproject or website as one of the project.
I am successfully abele to add the references into the other project. using
this following lines of code.
foreach (Project proj in projs){

if (!proj.Name.Contains("BusinessObjects") && !proj.Name.Contains("http"))

{

VSProject2 vsProj = (VSProject2)proj.Object;

vsProj.References.AddProject(boProj);

}



}

As I am trying to add the project reference into webproject I will get an
error as "unable to casat the object of type System.__ComObject into the
type VSLangProj.VSProject2".

Actually I am getting error in the line

VSProject2 vsProj = (VSProject2)proj.Object;

When proj>Object is other than webproject this casting works fine but it
gives error when proj.Object contains the reference of the website project.

Thanks in Advance
Regards,
Anubhav Jain
MTS
Persistent Systems Pvt. Ltd.
Ph:+91 712 2226900(Off) Extn: 2431
Mob : 094231 07471
www.persistentsys.com
Persistent Systems -Software Development Partner for Competitive Advantage.
Persistent Systems provides custom software product development services.
With over 15 years, 140 customers, and 700+ release cycles experience, we
deliver unmatched value through high quality, faster time to market and
lower total costs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top