Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Unable to launch Visual Studio from WPF app.

$
0
0

Dear All

I've requirement to change the properties of a project through WPF app. So I've developed a app which asks for the solution path  and tries to change the properties of the specified project.

When I debug my WPF app everything works fine, but when i try to run my app, I get the following error.

"Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))".

I do not want to launch the Visual Studio window but just to change the properties and save it.

Please help...

Here is my code and I need to run this method in DoWork event of BackgroundWorker, so it does not block my UI.

private void ModifySetUpProject()
        {
            Solution sln=null;
            try
            {
                EnvDTE.DTE visualStudio = (EnvDTE.DTE)Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.10.0", "");
                sln = visualStudio.Solution;
                sln.Open(setupPath + @"\MySetUp.sln");
                Projects projCollection = sln.Projects;
                for (int i = 1; i <= projCollection.Count; i++)
                {
                    if (projCollection.Item(i).Name == "MySetUp")
                    {                                       
                        projCollection.Item(i).Properties.Item("Description").Value = "Includes feature 234";                        
                        break;
                    }
                }
                sln.Close(true);                
            }
            catch (Exception ex)
            {
                if (sln != null)
                    sln.Close(true);               
            }
            finally
            {
                if (sln != null)
                    sln.Close(true);
            }
        }

Thanks in Advance.

Murali Mahendra Banala


Murali Mahendra Banala


Viewing all articles
Browse latest Browse all 4410

Trending Articles