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
  1. Home
  2. General Programming
  3. Visual Basic
  4. Installer [modified]

Installer [modified]

Scheduled Pinned Locked Moved Visual Basic
helpxml
2 Posts 1 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.
  • K Offline
    K Offline
    KenBonny
    wrote on last edited by
    #1

    I'm making an installer of my webservices and I'm stuck at the last bit. I'm trying to change some values in a custom xml file that I'm installing. I don't save my settings in an web.config file, but in either public, protected or private.config.xml file. I want to change the $logPath$ variable in the document with the installation path. I've figured out that with custom code I can do:

        MyBase.Install(stateSaver)
    
        Dim xmlDocument As New System.Xml.XmlDocument
        Dim strPath As String = System.IO.Path.Combine(Context.Parameters.Item("TARGETDIR"), "public.config.xml")
    
        If System.IO.File.Exists(strPath) Then
            xmlDocument.Load(strPath)
    
            xmlDocument.ToString().Replace("$logPath$", Context.Parameters.Item("TARGETDIR"))
    
            xmlDocument.Save(strPath)
        End If
    

    Rinse and repeat for the other files. But I get an error: "1001 - parameter path1 cannot be null". That's the first parameter of the System.IO.Path.Combine() function. But it's not null, there should be a path set.

    modified on Monday, June 27, 2011 10:35 AM

    K 1 Reply Last reply
    0
    • K KenBonny

      I'm making an installer of my webservices and I'm stuck at the last bit. I'm trying to change some values in a custom xml file that I'm installing. I don't save my settings in an web.config file, but in either public, protected or private.config.xml file. I want to change the $logPath$ variable in the document with the installation path. I've figured out that with custom code I can do:

          MyBase.Install(stateSaver)
      
          Dim xmlDocument As New System.Xml.XmlDocument
          Dim strPath As String = System.IO.Path.Combine(Context.Parameters.Item("TARGETDIR"), "public.config.xml")
      
          If System.IO.File.Exists(strPath) Then
              xmlDocument.Load(strPath)
      
              xmlDocument.ToString().Replace("$logPath$", Context.Parameters.Item("TARGETDIR"))
      
              xmlDocument.Save(strPath)
          End If
      

      Rinse and repeat for the other files. But I get an error: "1001 - parameter path1 cannot be null". That's the first parameter of the System.IO.Path.Combine() function. But it's not null, there should be a path set.

      modified on Monday, June 27, 2011 10:35 AM

      K Offline
      K Offline
      KenBonny
      wrote on last edited by
      #2

      I didn't know I had to pass the variables I want to use to my installer class. Read the below article to know what I did wrong (and how you can avoid it too). Visual Studio Setup - projects and custom actions, by Phil Wilson

      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