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. .NET (Core and Framework)
  4. Deployment question

Deployment question

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpvisual-studiosysadminwindows-adminhelp
6 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.
  • J Offline
    J Offline
    JoltWork
    wrote on last edited by
    #1

    :confused:Hello! Im trying to write a deployment project in VS.net 2005. What Im trying to do is this. Take the target installation path and write this string value to the registry. I just cant figure out how to do this. I know how to write to the registry, but somehow I need to get the target path and write this parameter to the registry. Very thankfull for any help.

    H P 2 Replies Last reply
    0
    • J JoltWork

      :confused:Hello! Im trying to write a deployment project in VS.net 2005. What Im trying to do is this. Take the target installation path and write this string value to the registry. I just cant figure out how to do this. I know how to write to the registry, but somehow I need to get the target path and write this parameter to the registry. Very thankfull for any help.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      The VS deployment projects aren't very flexible. You might be better off using WiX[^]. That said, you can use [TARGETDIR] for your registry value in most cases. If you're trying to write the exact location of a file you can use the notation [#filekey] but that where things get difficult, since the VS.NET deployment projects don't show you the component, file, registry, etc. key names (the deployment projects compile into .msi files, which are relational databases processed by Windows Installer).

      This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

      J 1 Reply Last reply
      0
      • H Heath Stewart

        The VS deployment projects aren't very flexible. You might be better off using WiX[^]. That said, you can use [TARGETDIR] for your registry value in most cases. If you're trying to write the exact location of a file you can use the notation [#filekey] but that where things get difficult, since the VS.NET deployment projects don't show you the component, file, registry, etc. key names (the deployment projects compile into .msi files, which are relational databases processed by Windows Installer).

        This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

        J Offline
        J Offline
        JoltWork
        wrote on last edited by
        #3

        Hello! Thanks for your answer! I found out [TARGETDIR] right after I posted :) What is WiX and where can I find it? Best regards!

        H J 2 Replies Last reply
        0
        • J JoltWork

          Hello! Thanks for your answer! I found out [TARGETDIR] right after I posted :) What is WiX and where can I find it? Best regards!

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          http://wix.sourceforge.net[^]

          This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

          1 Reply Last reply
          0
          • J JoltWork

            Hello! Thanks for your answer! I found out [TARGETDIR] right after I posted :) What is WiX and where can I find it? Best regards!

            J Offline
            J Offline
            JoltWork
            wrote on last edited by
            #5

            It looks promissing I must say! Does this integrate into VS.net?

            1 Reply Last reply
            0
            • J JoltWork

              :confused:Hello! Im trying to write a deployment project in VS.net 2005. What Im trying to do is this. Take the target installation path and write this string value to the registry. I just cant figure out how to do this. I know how to write to the registry, but somehow I need to get the target path and write this parameter to the registry. Very thankfull for any help.

              P Offline
              P Offline
              perlmunger
              wrote on last edited by
              #6

              If you create your own project installer (System.Configuration.Install.Installer), you can easily get the install path by just using reflection on the executing assembly. Here is some code I use to do this in my installer:

              /// Since this assembly is being run from the install directory, it will return the full
              /// path to this assembly. You can simple get the directory path using a FileInfo object
              /// to know where it's been installed.
              System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
              string baseAppDir = (new System.IO.FileInfo( asm.Location )).DirectoryName;

              /// We're certain this exists because our setup program created it.
              RegistryKey softwareKey = Microsoft.Win32.Registry.LocalMachine
              .OpenSubKey( "Software", true )
              .OpenSubKey( "Company Name", true )
              .OpenSubKey( "Application Name", true );

              softwareKey.SetValue( "InstallLocation", configFilepath );

              Keep in mind that I added a registry value in setup project that creates the HKLM\Software\Company Name\Application Name\InstallLocation key with some default or empty value. The setup project actually creates the keys you specified in the registry editor part of the setup project before it calls your code in the Installer class. -Matt

              ------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall

              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