Creating a .net solution programmatically
-
30 апреля 2012 г. 8:31
can someone please help me out... how can i programmatically create a .net application that can generate other .net applications??
thanks in advance
Все ответы
-
30 апреля 2012 г. 9:49
- Изменено Gowthaman Selvam 30 апреля 2012 г. 9:50
-
30 апреля 2012 г. 10:10
thank for your reply gowthaman. i am not able to import the EnvDTe namespace in my application... how can i do that?
thank you again
-
1 мая 2012 г. 1:36Модератор
Hi Stevie,
The only way to do this is via COM automation, unless you're code is running inprocess to the devenv.exe (VS IDE), for example, a Add-in, Package or custom project wizard (IWizard).
If you need to do this from your own application, you'll have to use COM automation to launch the VS IDE, and then leverage it's DTE automation interface, to invoke the automation APIs that wrap project generation.
The tricky part here is that you have to worry about the COM call's timing out, because generating a project can be a lengthy process. I wrote a simple console application years ago that illustrates how to do this (but as a workaround to fix some problems with installing controls in the VS toolbox). But the principles still hold.
The only remnant of that code I could find is in Chetan's blog on the original toolbox issue. But the code in that blog entry where I create the temporary WinForms project is pretty much what you're looking for.
Sincerely,
Ed Dore
- Предложено в качестве ответа Ed DoreMicrosoft Employee, Moderator 1 мая 2012 г. 1:36
-
1 мая 2012 г. 7:21
hi ed,
i'll have a look into it... thank you very much for replying...
sincerely
stevie
-
4 мая 2012 г. 21:12
still struggling man... ok what my situation is like this.... my program allows the user to drag fields from an access database and drop them onto to form... it then proceeds to generates some controls... after the user finishes choosing the field he needs the program should generate a .net solution with those fields in it with the respective data bindings allowing the user to run that .net solution as a different application... any ideas??
thank you in advance
-
4 мая 2012 г. 21:14sample code would be great

