Results 1 to 4 of 4

Thread: ClickOnce and app.config file

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    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 2002
    Posts
    34,687

    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 don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * 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??? *

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2012
    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 2002
    Posts
    34,687
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * 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??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width