473,473 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create an Instance of Visual Studio

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
Aug 24 '08 #1
13 3701
On Sun, 24 Aug 2008 00:08:21 -0700, miztaken <ju**********@gmail.com>
wrote:
[...]
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?
Maybe I'm missing something about your question, but...

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.

Pete
Aug 24 '08 #2
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
Aug 24 '08 #3
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" <ju**********@gmail.comwrote in message
news:aa**********************************@p31g2000 prf.googlegroups.com...
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

Aug 24 '08 #4
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.
"miztaken" <ju**********@gmail.comwrote in message
news:51**********************************@v13g2000 pro.googlegroups.com...
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
Aug 24 '08 #5
On Sun, 24 Aug 2008 00:54:43 -0700, miztaken <ju**********@gmail.com>
wrote:
So do you mean i have to ask my client to install visual studio IDE to
run my application?
If your application requires Visual Studio to be present, then yes. You
do.
This doesn't seem to be feasible solution..
I agree. So, as Mike says, why are you writing your application with a
dependency on Visual Studio? What are you doing with Visual Studio that
is so essential for your program?

Pete
Aug 24 '08 #6
miztaken wrote:
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.

--

Aug 24 '08 #7
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/libr...72(VS.80).aspx

Why would Microsoft suggest something like this.

I am confused and dont know what to do.

Please help me

miztaken
Aug 25 '08 #8
On Sun, 24 Aug 2008 23:21:02 -0700, miztaken <ju**********@gmail.com>
wrote:
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/libr...72(VS.80).aspx

Why would Microsoft suggest something like this.
I don't think they do.

The article you referenced starts with this sentence:

If you programatically call into Visual Studio automation
from an external (out-of-proc), multi-threaded application,
you can occasionally get the errors "Application is busy"
or "Callee was rejected by caller."

In other words, the solution described in that article is specifically for
a situation in which you are _already_ automating Visual Studio.

I don't see anything in that article that suggests you ought to _add_ a
dependency to Visual Studio if you don't already have one.
I am confused and dont know what to do.
Perhaps you could go back to the beginning. What are you _really_ trying
to do?

You seem to have already settled on a solution for whatever problem it is
you have, but unfortunately you've misread the references you're looking
at and seem to have gotten yourself into a situation where the solution
you're attempting is entirely inappropriate.

Rather than asking how to get an entirely inappropriate solution to work,
it would probably be better to work on getting a solution that isn't
entirely inappropriate.

Pete
Aug 25 '08 #9
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

Aug 25 '08 #10
On Sun, 24 Aug 2008 23:56:54 -0700, miztaken <ju**********@gmail.com>
wrote:
Hi there,
I am doing OLE Automation not VS automation.
Well, yes and no. It's clear from your first post that you ARE using VS
automation. That's what creating an instance of Visual Studio
programmatically is. Automation.

But, I also understand your statements to mean that you are only using VS
automation because of the article you referenced. And since you would not
be using VS automation except for having read that article, we can safely
say that the article that you've referenced is not relevant to your
original problem.
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.
What is it about using VS automation that seems to address your problem?
I am certain that using VS automation is not what you want to do, but it's
possible that understanding why you thought that article was helpful, and
what the code in the article is actually accomplishing for you would help
us to understand what your original problem is.
This is what i am doing and i am getting error?
The only error you've described so far is the inability to automate VS
without having VS installed. That error is completely expected and we
really can't get you past that without suggesting one of two things:
either stop trying to automate VS, or tell your client that they need to
install VS.

Personally, my vote is for "stop trying to automate VS". But no one can
help you do that until you explain what problem it is you were having that
led you to automating VS in the first place.

Pete
Aug 25 '08 #11
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/libr...72(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

Aug 25 '08 #12
On Mon, 25 Aug 2008 03:14:55 -0700, miztaken <ju**********@gmail.com>
wrote:
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.
Well, I do agree your problem doesn't appear to be related to this forum.
But your mistaken use of VS automation doesn't really change that. It's
still not related to this forum.
[...]
So i googled for a while and then for Error 2, i came up with the
above link
http://msdn.microsoft.com/en-us/libr...72(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?
It's hard to say. After all, this isn't the correct forum so there's not
necessarily anyone here who actually knows the answer to the problem
you're really having. I know I don't.

But, looking at the link you posted, it's not clear to me why you're using
the VS automation as part of that solution. The interesting part of the
sample code has nothing to do with VS. They just happen to be presenting
it in the context of VS automation. But it looks to me as though all you
really need is the MessageFilter class that's there. The rest of the
stuff in the Main() method is just for demonstration purposes, including
the VS automation.

So, copy the MessageFilter class and IOleMessageFilter interface
declarations to your own project, call MessageFilter.Register() before you
automate Excel, and MessageFilter.Revoke() when you're done. Don't do any
of the VS automation stuff.

If that doesn't do the trick, then you probably need to find a forum where
Excel automation is more on-topic. Your chance of finding someone who
actually has some expertise in the area is much greater there than here.

Pete
Aug 25 '08 #13
No it didnt worked.

I am consulting other forum..

thanks for your help

miztaken
Aug 26 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark Huebner | last post by:
I have Visual Studio 2003 Professional and MS SQL Server 2000 installed on my laptop. For some reason, I can't create a new database with the Visual Studio Server Explorer. The error message is...
0
by: Nate | last post by:
Hi All, I am having difficulty creating a new instance of a proxy for an XML Web Service in my Web Form Client (VB) .NET code. When I try to run my 'hello world' file, hw.aspx, I receive the...
1
by: Gerard Yin | last post by:
Hi, I'm trying to create an instance of Visual Studio and open a file in it, in a console C# application. EnvDTE.DTE aDTE = (EnvDTE.DTE) Microsoft.VisualBasic.Interaction.CreateObject(...
4
by: tlemcenvisit | last post by:
Hello I'd like to create and affich an instance of the form "Form2" as a mdichild of the actual form. In C#.net, I know that is like this : Form2 MyForm=new Form2(); MyForm.MdiParent=this;...
1
by: Jon H | last post by:
Whenever I try to create an asp.net webapplication, I keep getting the error: Cannot find the components for communicating with the frontpage server extensions. I tried reinstalling Visual Studio...
2
by: Jay Bienvenu | last post by:
I cannot create new Web applications in Visual Studio .NET 2003. I get this error message: "Visual Studio .NET cannot create or open the application. The likeliest problem is that required...
6
by: JonSteng | last post by:
..Net Visual Studio Professional 2003 Version 7.1.3088 ..Net Framework 1.1 SP1 Version 1.1.4322 IIS 5.1 Windows XP Professional SP2 Micron T3000 Laptop (1.5 GHz; 1GB RAM; 40GB HD with 17GB Free)...
11
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug...
4
by: cj | last post by:
Here's what I'm trying to do direct from MS (Create a Database) http://msdn2.microsoft.com/en-us/library/ms247254(VS.80).aspx Only I have VS 2005 Pro instead of Visual Web Developer. I do have...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.