Create an Instance of Visual Studio

M

miztaken

Hi,
My C# application have a following code to create an instance of
Visual Studio.

System.Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE.
8.0");
Object obj = System.Activator.CreateInstance(type, true);
EnvDTE80.DTE2 dte8Obj = (EnvDTE80.DTE2)obj;
MessageFilter.Register();
dte8Obj.MainWindow.Visible = false;

This code work ok in the PC with Visual Studio Installed but doesnt
work in the PC with only Framework installed.?

How can i make this work in PC with only framework installed?

I am using Visual Studio 2005

Thank You
miztaken
 
M

miztaken

If you don't have Visual Studio installed, you simply cannot create an  
instance of it.  That's what it means to install it: you copy the code  
that is required for the product to run (including any COM automation the 
application might support).  That's the whole point of installation.

So do you mean i have to ask my client to install visual studio IDE to
run my application?
This doesn't seem to be feasible solution..

If this code
System.Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE.
8.0");
Object obj = System.Activator.CreateInstance(type, true);
EnvDTE80.DTE2 dte8Obj = (EnvDTE80.DTE2)obj;
MessageFilter.Register();
dte8Obj.MainWindow.Visible = false;

required Visual Studio installed then how can we ship it?

Thank You
miztaken
 
F

Family Tree Mike

No, requiring users to have Visual Studio does not seem feasible. Why are
you doing this then? What do you want them to do with the IDE?

miztaken said:
If you don't have Visual Studio installed, you simply cannot create an
instance of it. That's what it means to install it: you copy the code
that is required for the product to run (including any COM automation the
application might support). That's the whole point of installation.

So do you mean i have to ask my client to install visual studio IDE to
run my application?
This doesn't seem to be feasible solution..

If this code
System.Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE.
8.0");
Object obj = System.Activator.CreateInstance(type, true);
EnvDTE80.DTE2 dte8Obj = (EnvDTE80.DTE2)obj;
MessageFilter.Register();
dte8Obj.MainWindow.Visible = false;

required Visual Studio installed then how can we ship it?

Thank You
miztaken
 
B

Bob Powell [MVP]

EnvDTE is the automation interface for Visual Studio. If your application
uses this interface it must be an extension of Visual Studio, either using
simple automation or as an add-in yes?

Whatever you're doing that requires Visual Studio will also require the
users of your program to install Visual Studio on their machines.

You could concievably ask them to install Visual Studio Express.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
T

Tim Jarvis

miztaken said:
This code work ok in the PC with Visual Studio Installed but doesnt
work in the PC with only Framework installed.?


Well, there are licensing issues to be resolved before deploying a
Visual Studio SDK solution (VSX). If you want to distribute the VS
shell with your app, you will have to pay for it (I believe), or if you
are simply deploying a plugin, then the assumption would be that your
users already have VS installed.

You should be able to find the answers to your VSX SDK questions here.

http://msdn.microsoft.com/en-au/vsx/default.aspx

Regards Tim.

--
 
M

miztaken

Well i need to create a new instance of VS to handle one exception
that i receive while fetching objects out of excel file.
This is an official solution for the project, i consulted Microsoft's
website for this:-

Please have a look at this link:
http://msdn.microsoft.com/en-us/library/ms228772(VS.80).aspx

Why would Microsoft suggest something like this.

I am confused and dont know what to do.

Please help me

miztaken
 
M

miztaken

Hi there,
I am doing OLE Automation not VS automation.
I am opening Excel File programmatically but when i create an
application then it gives me error so the solution was to create a new
instance of VS and then automate the excel application and then do
works, close excel app and close the instance of VS.
This is what i am doing and i am getting error?

Thank You
miztaken
 
M

miztaken

Hi Peter,
you are correct.

The problem, to solve which, i have used that VS Automation code, is
not related to this forum thus i didnt posted the thing in detail.
But here is my problem:
My application requires me to extract embedded office file from Office
Files i.e. embedded documents from Office Files.They are called
InlineShapes.
So while creating an instance of it (Office File) i get an unusual and
unpredictable exception like:

1. Error: Exception from HRESULT: 0x800A03EC
2. Error: Call was rejected by callee. (Exception from HRESULT:
0x80010001 (RPC_E_CALL_REJECTED))

So i googled for a while and then for Error 2, i came up with the
above link
http://msdn.microsoft.com/en-us/library/ms228772(VS.80).aspx
The title of the article on the web states the same title [Call was
rejected by callee.]
So i don't think its not relevant, or am i missing something?

Anyways, i used that code and it was stable.
But when i stated testing and deploying i got this problem?

Thank You
miztaken
 

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

Top