Results 1 to 4 of 4

Thread: ClickOnce and app.config file

  1. #1
    New Member
    Join Date
    Feb 12
    Posts
    4

    ClickOnce and app.config file

    I have a new WinForms application that I'm trying to deploy with the ClickOnce method. However, the app.config file that is needed for the application is not included with the installation.

    The application is installed properly from the server, and launches the exe, but as soon as I try to login by hitting my WCF Server, I get.

    "Could not find the file 'C:\Documents and Settings\Adminstrator\Local Settings\Apps\2.0\7KAA3h20\app.config"

    I can manually copy the file from my development machine to this folder and the application works fine.

    Any ideas?

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,636

    Re: ClickOnce and app.config file

    That's because it's not called app.config.... sounds like you're trying to access the file directly, rather than use the built-in methods. After compiling, look in the bin/debug or bin/release folders .... you'll find that the config file is application_name.config ....


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

  3. #3
    New Member
    Join Date
    Feb 12
    Posts
    4

    Re: ClickOnce and app.config file

    Interesting,

    I remembered I had a function that uses the app.config file in xdocument to identify my Web Service endpoints. My reference to it is hard coded. I also have a couple of other files that I reference in a similar way that are relocated with the ClickOnce installation.

    Code:
        Public Shared Function GetServiceEndpoint(ByRef InterfaceType As String) As String
            Dim ServiceEndpoint As String
            Directory.SetCurrentDirectory(Globals.WorkingDirectory)
            Dim startPosition As Integer = InterfaceType.LastIndexOf(".") + 1
            Dim InterfaceName As String = InterfaceType.Substring(startPosition)
            InterfaceName = InterfaceName.Replace("Channel", "")
            Dim doc As XDocument = XDocument.Load("../../app.config")
    
            ServiceEndpoint = _
                (From ep In doc.Descendants("endpoint")
                    Where (ep.Attribute("contract").Value.Contains(InterfaceName))
                     Select ep.Attribute("name")).Last().Value.ToString()
    
            Return ServiceEndpoint
    
        End Function
    Now to find a workaround....

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,636
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •