We help IT Professionals succeed at work.

VC++ Project Model Extensibility

posternb
posternb asked
on
244 Views
Last Modified: 2010-04-01
Hi guys.  I've been writing an Add-in for VS.NET and I'm currently experiencing some odd behaviour from some of the objects in the Visual C++ Project Model. The MSDN documentation is a little light and I haven't been able to find a shred of evidence on the internet that anyone else is even using these interfaces, let alone having this problem, but hopefully someone here might know something.

Anyway my problem is specifically with the VCCLCompilerTool object. My add-in programmatically sets some of the compiler properties for projects. What is odd is some projects refuse to let their properties be changed (returning 0x80070005 "Access is Denied") and this behaviour seems to be dependent on how/when they're added to a solution! Without going into the complete specifics, basically some projects that don't work when loading up a solution do work when added into a solution that already worked... but then when that solution is saved and reloaded later it doesn't work again! What's worse is attempting to set the properties on a 'bad' project (one that fails) apparently 'poisons' the environment, such that no subsequently opened solution will work (even if it had originally) until I completely shutdown and restart devenv. I have yet to find any difference that might cause one project to be 'bad' versus another...

BTW, my program removes read-only from the project files if they were (was originally causing it not to work at all) and in my desperation I've removed all other vestiges of SourceSafe being involved so I'm fairly confident that that is not the cause.

Any ideas?
Comment
Watch Question

CERTIFIED EXPERT
Author of the Year 2009

Commented:
I have no experience in this, but... it occurs to me that certain changes might be disallowed in certain cases -- the enviroment can't just simply change a particular thing because it would affect other things -- that sort of deal.

 What kinds of project settings are you changing?

-- Dan

Author

Commented:
Good suggestion, but I don't think that is the case.  The properties being changed are things like warning level (/W4) or optimization (/O2) or adding/removing #defines, etc -- things that only affect the project being changed, and things that should always be available (theoretically... when are you ever restricted from changing a compiler setting, besides on a read-only project file?).  

And what is more peculiar is, as I mentioned, how it will work in some cases but not in others for the same exact projects -- seemingly dependent on whether or not they were added to a solution or opened with one...

This the interface's docs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcext/html/vxlrfvcprojectenginelibraryvcclcompilertool.asp
CERTIFIED EXPERT
Author of the Year 2009

Commented:
One other thing...
Have you ever noticed that while compiling, the Settings menu is dimmed out?  There must bee an internal setting that sasy "I'm working... no changes are allowed right now"  Just a surmise... but consider that some "compiling" goes on in the background; ie., when the system is reeading headers so that Intellisense can work.  Maybe the DOM has a read-only flag that means something like "busy... do not disturb"

-- Dan

Author

Commented:
Yes, it's very possible that some particular action is causing the object's methods to be inaccessible, but then the question remains what is that action and why?  All I'm doing is opening/closing solutions, adding/removing projects, and changing compiler settings... that I'm aware of.  Unfortunately, it doesn't seem to be tied in with the user's ability to change compiler settings -- I have yet to ever be denied changing them from the dialog.  Out of curiosity, I actually tried changing them during a build (manually, via the dialog) and to my surprise it let me, though the changed settings didn't take effect until the next build.  
(I'm using VS 7.1 btw)
CERTIFIED EXPERT
Author of the Year 2009

Commented:
I use vs6 for now.  It was just a thought.

As I recall from vs7, they changed the concept of a "active project" and all you can do is build the "solutiuon" or whatever the marketting bean counter decided to call it :)

Doe the vs7 DOM have the concept of a default project?  And if so, perhpas some things are disallowed on that project but allowed on others.

Author

Commented:
Yeah they renamed workspaces as 'solutions' though I don't see why.  It's been a while since I used VC6 so I don't really remember how active projects work; in VC7 there is a 'startup project' you can set, but that mainly just determines which project gets executed when you hit F5.  You can build the whole solution or any individual project at any time...  At any rate, the startup project doesn't appear to have any effect on the phenomenon.

I'm tempted to just claim the object is implemented incorrectly and blame Microsoft but I suppose that doesn't really solve my problem.  :)  I guess I could manually open a project file, parse it, change the values and rewrite it but that may require the user to  dismiss the dialog saying the project was modified outside the IDE everytime I do it and for each project...  Thank you for your suggestions though, I appreciate it.

Commented:
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately one week.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
https://www.experts-exchange.com/help.jsp#hs5

Tinchos
EE Cleanup Volunteer

Author

Commented:
OK, I've requested to have the question closed.  
I ended up giving up on getting the COM interface to work, and just used an XML parser to change the project files manually, as I hinted I might try.
Thanks
CERTIFIED EXPERT
Author of the Year 2009

Commented:
That's fine with me.  I suggest that the Moderator refund the points and saving this in the PAQ database.
-- Dan
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.