By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,448 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Dynammically adding project references into the webproject.

P: n/a
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.

Apr 17 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.