Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to Open a .cs file in already Opened Visual Studio2005 IDE

How to Open a .cs file in already Opened Visual Studio2005 IDE

Scheduled Pinned Locked Moved C#
csharpvisual-studiotutorial
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    himuskanhere
    wrote on last edited by
    #1

    Helloo friend, I have to Open a .cs file through C# code. i have code like this ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "devenv.EXE"; startInfo.Arguments = path; // (path of .cs file) Process.Start(startInfo); but it creates new instance of VS2005, whereas i want to open a file in already opned VS2005 IDE. Thanks in advance.:cool:

    F D H 4 Replies Last reply
    0
    • H himuskanhere

      Helloo friend, I have to Open a .cs file through C# code. i have code like this ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "devenv.EXE"; startInfo.Arguments = path; // (path of .cs file) Process.Start(startInfo); but it creates new instance of VS2005, whereas i want to open a file in already opned VS2005 IDE. Thanks in advance.:cool:

      F Offline
      F Offline
      fly904
      wrote on last edited by
      #2

      Your starting a new process so obviously it is going to open a new instance.

      hmmm pie

      H 1 Reply Last reply
      0
      • F fly904

        Your starting a new process so obviously it is going to open a new instance.

        hmmm pie

        H Offline
        H Offline
        himuskanhere
        wrote on last edited by
        #3

        that is my question.... i want to open a file in already opened VS editor.

        D 2 Replies Last reply
        0
        • H himuskanhere

          Helloo friend, I have to Open a .cs file through C# code. i have code like this ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "devenv.EXE"; startInfo.Arguments = path; // (path of .cs file) Process.Start(startInfo); but it creates new instance of VS2005, whereas i want to open a file in already opned VS2005 IDE. Thanks in advance.:cool:

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          Instead of passing devenv.exe, why not just pass the .cs file. If the file associations on the machine are correct that should work.

          Dave
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
          Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

          H 1 Reply Last reply
          0
          • D DaveyM69

            Instead of passing devenv.exe, why not just pass the .cs file. If the file associations on the machine are correct that should work.

            Dave
            BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
            Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

            H Offline
            H Offline
            himuskanhere
            wrote on last edited by
            #5

            Exception occurs: Cannot start process because a file name has not been provided.

            D 1 Reply Last reply
            0
            • H himuskanhere

              Helloo friend, I have to Open a .cs file through C# code. i have code like this ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "devenv.EXE"; startInfo.Arguments = path; // (path of .cs file) Process.Start(startInfo); but it creates new instance of VS2005, whereas i want to open a file in already opned VS2005 IDE. Thanks in advance.:cool:

              F Offline
              F Offline
              fly904
              wrote on last edited by
              #6

              Excecute a command promt command: ">open c:\goo\bar.cpp"

              hmmm pie

              1 Reply Last reply
              0
              • H himuskanhere

                Helloo friend, I have to Open a .cs file through C# code. i have code like this ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "devenv.EXE"; startInfo.Arguments = path; // (path of .cs file) Process.Start(startInfo); but it creates new instance of VS2005, whereas i want to open a file in already opned VS2005 IDE. Thanks in advance.:cool:

                H Offline
                H Offline
                himuskanhere
                wrote on last edited by
                #7

                Hey frnds, Thanks for ur reply.. i have ovecome this issue... But my new issue is.. If i have opend a file in VS2005 IDE how to navigate to specific line number.. means: i have to open a .cs file and current control is at line no. 10

                1 Reply Last reply
                0
                • H himuskanhere

                  that is my question.... i want to open a file in already opened VS editor.

                  D Offline
                  D Offline
                  DaveyM69
                  wrote on last edited by
                  #8

                  send it as the filename not as an arg

                  Dave
                  BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                  Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

                  1 Reply Last reply
                  0
                  • H himuskanhere

                    Exception occurs: Cannot start process because a file name has not been provided.

                    D Offline
                    D Offline
                    DaveyM69
                    wrote on last edited by
                    #9

                    Instead of down-voting the answer, why not reread it and use some logic. :mad: This works perfectly for your original question.

                    void OpenCSFile(string path, string filename)
                    {
                    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.FileName = path + Path.DirectorySeparatorChar + filename;
                    Process.Start(startInfo);
                    }

                    Dave
                    BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                    Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

                    1 Reply Last reply
                    0
                    • H himuskanhere

                      that is my question.... i want to open a file in already opened VS editor.

                      D Offline
                      D Offline
                      DaveyM69
                      wrote on last edited by
                      #10

                      See my answer here.

                      Dave
                      BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                      Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups