Installer [modified]
-
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
-
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
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