locked
Can't include a separate .config file RRS feed

  • Question

  • User-1158769213 posted

    I have a WPF project (.NET 4.5 if it makes any difference) in VS2017, which has a whole pile of code in the app.config file that I would like to move into a separate file.

    As an example, I have something like this...

    <system.serviceModel>
      <client>
        <endpoint address="http://localhost:50000/Users/UserService.svc"
                  behaviorConfiguration="LargeMessageBehavior"
                  binding="customBinding"
                  bindingConfiguration="CustomBindingReliable"
                  contract="CRMUsersServiceReference.UserService"
                  name="CustomBinding_UserService" />
      <!-- more... -->
    </system.serviceModel>

    ...where there are many <endpoint> entries. I also have other sections inside <system.serviceModel> which I would like to move out.

    Now I understand that I can't do an include on the whole <system.serviceModel> section because it's a group, so will have to do a separate include for each section inside (such as <client>).

    However, I can't get this to work. According to this SO answer, backed up by the MSDN docs, I should be able to do the following...

    <system.serviceModel>
      <client configSource="client.config">
      </client>
    </system.serviceModel>

    When I try this, I get a run-time exception ConfigurationErrorsException: The attribute 'configSource' cannot be specified because its name starts with the reserved prefix 'config' or 'lock'.

    According to this answer here, I should be able to use source instead, but that gives a run-time exception System.Configuration.ConfigurationErrorsException: 'Unrecognized attribute 'source'. Note that attribute names are case-sensitive.'

    Intellisense doesn't show much...

    Anyone any ideas?

    Thursday, November 22, 2018 3:16 PM

All replies

  • User1120430333 posted

    The WPF project is the root project, which should have an app.config file in the project that is the root.config. All configuration information, all of it, must be in the root project's app.config, becuase that is where .NET looks for all configuration information to be in the root.config at program runtime.

    Visual Studio when there is a successful build  of the WPF project creating a programname.exe file in the Bin folder, it  also creates a programname.exe.config that was copied from the root project's app.config in the Bin folder too. 

    If you deploy the programname.exe to a machine, the programname.exe.config must be deployed to the same location so that .NET can find the configuration information at program runtime.

    If there is 1,000 lines in the root app.config, then so be it.

    The only time I have seen work that you are talking about was user.config being used by a Web.config. The user.config(s) had different versions of connectionstrings in each one of them that could be used by the Web.config.

    Thursday, November 22, 2018 4:28 PM
  • User-1158769213 posted

    Hello,

    The reason I want to do it is because I have a service proxy project, which consumes a load of WCF services. This proxy is used by three different client projects (one WPF and two ASP.NET). I want to have the endpoint bindings in one config file in the proxy project (not the main one), add that as a link in the client projects, and include it in their config files. That avoids the regular mistake of people adding services to the proxy and forgetting to update the client config files.

    According to MSDN, this is supposed to work. However, as you can see from the screenshot, Intellisense doesn't recognise either of the two suggested attributes for including a file, one of which is documented in MSDN.

    Thanks anyway, but I would like to do this, and as it is documented as being supposed to work, I don't understand why it doesn't.

    Thursday, November 22, 2018 4:37 PM
  • User1120430333 posted

    Thanks anyway, but I would like to do this, and as it is documented as being supposed to work, I don't understand why it doesn't.

    Yeah, what you want to do and what .NET is going to let you do are two different things. :) I guess you may find out the hard way that you  can't squeeze blood out of a turnip.

    Thursday, November 22, 2018 4:51 PM
  • User-1158769213 posted

    Why am I trying to squeeze blood out of a turnip? This is not something esoteric and obscure, it's clearly documented in MSDN. Why shouldn't I be able to do it?

    Great metaphor by the way!

    Thursday, November 22, 2018 4:55 PM
  • User1120430333 posted

    Why am I trying to squeeze blood out of a turnip? This is not something esoteric and obscure, it's clearly documented in MSDN. Why shouldn't I be able to do it?

    Great metaphor by the way!

    You'll know what it means when you peal yourself off the wall as you dive into it after so many attempts and stop. 

    Thursday, November 22, 2018 6:00 PM
  • User-1158769213 posted

    So if you come across something that isn't working the way the docs say, you just give up? Can't imagine I'd get much work done that way. Most of the best learning I've done has been through finding out why things didn't work.

    If this were something that wasn't supposed to work, or was a bad idea, then I would agree with you, but this is something clearly described in MSDN. I don't see any reason why I should just give up and assume the docs are wrong without trying to get it to work.

    Thursday, November 22, 2018 6:06 PM
  • User1120430333 posted

    Yossu

    So if you come across something that isn't working the way the docs say, you just give up? Can't imagine I'd get much work done that way. Most of the best learning I've done has been through finding out why things didn't work.

    If this were something that wasn't supposed to work, or was a bad idea, then I would agree with you, but this is something clearly described in MSDN. I don't see any reason why I should just give up and assume the docs are wrong without trying to get it to work.

    I don't see it working not for a desktop solution that uses a runtime config file  that must accompany the exe on deployment. If it's going to work, it most likely is going to work in a Web.config, which I have seen something similar working with user.config and Powershell as it manipulated the user.config that the Web.config was using.

    Yeah I leaned long ago not pull my hair out and take another path as a software developer all the way from the IBM mainframe technology back in the 1980(s) to current .NET technology. 

    Yeah, you do what you want to do. It's your show and  I hope you have some hair left after so many years. :)

    Thursday, November 22, 2018 6:42 PM
  • User-893317190 posted

    Hi Yossu,

    How do you use the configsource? 

    Although the visual studio may not recognize the configSource property, you could still use it.

    I have tried to used the separated .config file and have a success , you could refer to it.

    Below is my configuration in web.config.

     <system.serviceModel>
         <services configSource="services.config">
           
         </services>
       <behaviors configSource="behaviors.config"/>
       </system.serviceModel>

    behaviors.config.

    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      https://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <behaviors>
    
    
      <serviceBehaviors>
    
    
        <behavior name="EchoServiceBehavior">
    
    
          <serviceMetadata httpGetEnabled="True" />
    
    
          <serviceDebug includeExceptionDetailInFaults="True" />
    
    
        </behavior>
    
    
      </serviceBehaviors>
    
    
    </behaviors>

    services.config.

    <?xml version="1.0" encoding="utf-8" ?>
    
      <services>
        <service name="MyWebFormCases.CalculatorService"  behaviorConfiguration="EchoServiceBehavior">
    
          <endpoint contract="MyWebFormCases.ICalculator"  binding="ws2007HttpBinding"></endpoint>
        </service>
      </services>

    The CalculatorService is a simple class.

     public class CalculatorService : ICalculator
        {
         
    
            int ICalculator.Add(int a, int b)
            {
                return a + b;
            }
        }
    
    
     [ServiceContract]
        public interface ICalculator
        {
            [OperationContract]
            int Add(int a, int b);
        }

    //.svc
    <%@ ServiceHost Service="MyWebFormCases.CalculatorService" %>

    web.config,services.config,behaviors.config are all at the root of the project.

    After I run the project,and visit http://localhost:57510/calculator.svc?wsdl

    The result (I haven't met your error)

    Best regards,

    Ackerly Xu

    Friday, November 23, 2018 7:15 AM
  • User-1158769213 posted

    Hello Ackerly,

    Thanks for the reply. Your code looks exactly like what I included in my very first post above, but as I said, Visual Studio flags it as an error, and it throws a runtime exception if I try it. That's what I'm trying to find out. I can't understand why it's failing, when MSDN, various blog posts and SO answers, etc all say it should work.

    Any ideas why it doesn't work for me? As you can see from the screenshot I added, Intellisense doesn't show very much, whereas MSDN says there should be quite a few attributes available.

    Thanks again.

    Saturday, November 24, 2018 10:08 PM
  • User1120430333 posted

    Any ideas why it doesn't work for me? As you can see from the screenshot I added, Intellisense doesn't show very much, whereas MSDN says there should be quite a few attributes available.

    The link you provided.

    https://docs.microsoft.com/en-us/dotnet/api/system.configuration.sectioninformation.configsource?view=netframework-4.5

    <copied>

    In ASP.NET applications, at run time you can assign to the ConfigSource property the name of an alternative configuration file. In that case, the contents of the file are overwritten by the default connection string information that is contained in the Web.config file. This occurs also when the alternative file does not exist and it is created at run time. If the Web.config file does not contain any connection string information, an empty section is added to the alternative file.

    <end>

    <copied>

    I have a WPF project (.NET 4.5 if it makes any difference) in VS2017, which has a whole pile of code in the app.config file that I would like to move into a separate file.

    <end>

    A WPF project is a Windows desktop solution, like a Windows form project, that makes a programname.exe and a programname.exe.config a runtime config that doesn't  have a static location like a Web.config has for a ASP.NET Web project. 

    It's plain and simple that what you are trying to do for a WPF Windows desktop solution is never going to work, IMO.  And you can't squeeze blood out of a turnip, or in other words,  you cannot make it/force it to  work, not for any of the  Windows desktop solutions mentioned that  also includes desktop solutions like a console, Windows service and Silverlight programs too. 

    Sunday, November 25, 2018 12:21 AM
  • User-1158769213 posted

    Hello again,

    Well, there are plenty of people out there doing exactly what I want to do in non-ASP.NET projects (see here, here and here for example, but there are plenty more). As for not finding the file, you just need to add it as a link and set the build action. This seems to work just the same for WPF, console apps, ASP.NET, etc. My issue is not the problem of finding the file, it's about specifying an include file in the first place. I never get anywhere near the issue of whether or not the file actually exists.

    Furthermore, this doesn't work for me in ASP.NET either. If you were correct, then I should be able to do this in my ASP.NET clients, and I can't. I get the same lack of suggestions in Intellisense as you see in the screenshot, and the same run-time errors if I try it.

    So, I don't think the WPF/ASP.NET issue is the problem here. If it makes it easier, we can discuss it in terms of ASP.NET, as I have the same problem there. You must agree that MSDN claims that this works for ASP.NET, so why doesn't it work for me?

    Thanks for the reply.

    Sunday, November 25, 2018 3:18 PM
  • User1120430333 posted

    Hello again,

    Well, there are plenty of people out there doing exactly what I want to do in non-ASP.NET projects (see here, here and here for example, but there are plenty more). As for not finding the file, you just need to add it as a link and set the build action. This seems to work just the same for WPF, console apps, ASP.NET, etc. My issue is not the problem of finding the file, it's about specifying an include file in the first place. I never get anywhere near the issue of whether or not the file actually exists.

    Furthermore, this doesn't work for me in ASP.NET either. If you were correct, then I should be able to do this in my ASP.NET clients, and I can't. I get the same lack of suggestions in Intellisense as you see in the screenshot, and the same run-time errors if I try it.

    So, I don't think the WPF/ASP.NET issue is the problem here. If it makes it easier, we can discuss it in terms of ASP.NET, as I have the same problem there. You must agree that MSDN claims that this works for ASP.NET, so why doesn't it work for me?

    Thanks for the reply.

    You show where plenty of people are out there doing what you are talking about. Show it. If it's working for other people, then I'll venture to guess it's something very simplistic.

    I can show you plenty of articles such as the link.

    http://www.drdobbs.com/managing-user-settings-in-the-webconfig/184416794

    The only time I have ever seen it working is with user.config and connectionstings being used by a Web.config  where a Powershell script changed the connectionstring in the user-config for databases running on various servers within the company's infrastructure when the developer ran the Powershell script from the command prompt giving the parms to Powershell and let it manipulate the user.config

    But in the mean time, what you are trying to do blows up. Can you show anywhere that an app.config that is only used during VS's debug mode and is not the runtime cionfig file is going to remotely work in the manner you are talking about for a desktop solution? Show some articles about a working solution in the manner you are talking about working with an app.config that is not even the runtime config file, which is using an external file. .

    Sunday, November 25, 2018 4:51 PM
  • User-471420332 posted
    keep into new folder...
    Sunday, November 25, 2018 4:52 PM
  • User-1158769213 posted

    You show where plenty of people are out there doing what you are talking about. Show it. If it's working for other people, then I'll venture to guess it's something very simplistic.

    Please see the three links that I included in my last post...

    1. The question asked in the first link was that the included file was invalid, meaning that the configSource attribute was recognised, and the file was found, but that the contents were invalid. Fixing the content would fix the problem.
    2. The second link is a blog post showing how to do exactly what I am trying to do, namely use the configSource attribute to include an external file.
    3. The third link is basically the same as the first, the attribute is recognised, and is reading the file, but the contents are not valid.

    Maybe I'm missing something, but I have shown you three links where people are doing this. I could link more, but didn't see the point.

    Sunday, November 25, 2018 5:05 PM
  • User1120430333 posted

    One other thing, why are you not posting to the WPF forum, since you are posting in the ASP.NET forums, right?

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf

    Sunday, November 25, 2018 5:06 PM
  • User-1158769213 posted

    mazhar khan india

    keep into new folder...

    Keep what in a new folder? and how does this answer my question?

    My problem is that an attribute clearly documented in MSDN is not recognised by VS, and causes a run-time error. I never get as far as trying to read the external file, so its location (if that's what you meant) is irrelevant.

    Thanks anyway.

    Sunday, November 25, 2018 5:07 PM
  • User-1158769213 posted

    One other thing, why are you not posting to the WPF forum, since you are posting in the ASP.NET forums, right?

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf

    Because it's exactly the same issue in my ASP.NET projects. It doesn't seem to be specifically related to either ASP.NET or WPF, but I was hoping someone here (or there) might be able to explain why the feature isn't working.

    Sunday, November 25, 2018 5:12 PM
  • User-471420332 posted
    can you share your screen short
    Sunday, November 25, 2018 5:17 PM
  • User1120430333 posted

    DA924

    One other thing, why are you not posting to the WPF forum, since you are posting in the ASP.NET forums, right?

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf

    Because it's exactly the same issue in my ASP.NET projects. It doesn't seem to be specifically related to either ASP.NET or WPF, but I was hoping someone here (or there) might be able to explain why the feature isn't working.


     I did see two of the 3 links you are talking about,  and they both were talking about ASP.NET  Web.config solutions. Maybe, I am missing the theme here as to what .NET tehnology is being used and it works.

    Sunday, November 25, 2018 5:19 PM
  • User-1158769213 posted

     I did see two of the 3 links you are talking about,  and they both were talking about ASP.NET  Web.config solutions. Maybe, I am missing the theme here as to what .NET tehnology is being used and it works.

    I have a proxy project that references a load of WCF services. That proxy project is referenced by one WPF project and two ASP.NET projects. At the moment, all three client projects have duplicate entries for the WCF service bindings, and I would like to extract these into one config file, rather than having duplicate settings in three projects.

    From what I have read, the include feature is supposed to work on any .NET config file, irrespective of whether it's in a WPF or ASP.NET project. However, feel free to ignore the WPF project if you prefer, as even if I could get this working for the two ASP.NET projects it would be an improvement on the current situation. 

    Thanks

    Sunday, November 25, 2018 5:29 PM
  • User-1158769213 posted

    can you share your screen short

    I already did, please see my first post.

    Sunday, November 25, 2018 5:30 PM
  • User1120430333 posted

    DA924

     I did see two of the 3 links you are talking about,  and they both were talking about ASP.NET  Web.config solutions. Maybe, I am missing the theme here as to what .NET tehnology is being used and it works.

    I have a proxy project that references a load of WCF services. That proxy project is referenced by one WPF project and two ASP.NET projects. At the moment, all three client projects have duplicate entries for the WCF service bindings, and I would like to extract these into one config file, rather than having duplicate settings in three projects.

    From what I have read, the include feature is supposed to work on any .NET config file, irrespective of whether it's in a WPF or ASP.NET project. However, feel free to ignore the WPF project if you prefer, as even if I could get this working for the two ASP.NET projects it would be an improvement on the current situation. 

    Thanks

    I don't see what you are doing is going to work, unless it involves a Web.config.

    Good luck to you....

    Sunday, November 25, 2018 5:35 PM
  • User-1158769213 posted

    I don't see what you are doing is going to work, unless it involves a Web.config

    It does, both ASP.NET projects contain a web.config file, and that's what I'm trying to modify to include an external file.

    Sunday, November 25, 2018 5:36 PM
  • User-1158769213 posted

    I don't see what you are doing is going to work, unless it involves a Web.config.

    Tell you what, let's start again, and I'll simplify the question...

    I have an ASP.NET MVC web project, and I would like to extract some of the settings in the web.config file into an external file. I currently have code like this...

    <system.serviceModel>
      <client>
        <endpoint address="http://localhost:50000/Users/UserService.svc"
                  behaviorConfiguration="LargeMessageBehavior"
                  binding="customBinding"
                  bindingConfiguration="CustomBindingReliable"
                  contract="CRMUsersServiceReference.UserService"
                  name="CustomBinding_UserService" />
      <!-- more... -->
    </system.serviceModel>

    ...and I would like to do this...

    <system.serviceModel>
      <client configSource="client.config">
      </client>
    </system.serviceModel>

    However, this shows as an error in VS, and gives a run-time exception when I try it, despite being documented in MSDN.

    Is that clearer? Thanks

    Sunday, November 25, 2018 5:43 PM
  • User1120430333 posted

    DA924

    I don't see what you are doing is going to work, unless it involves a Web.config

    It does, both ASP.NET projects contain a web.config file, and that's what I'm trying to modify to include an external file.

    Again, a WPF solution is a Windows desktop solution that is not using a Web.config that I know about.. It is NOT being hosted by IIS.. It is not an ASP.NET Web solution. The Windows desktop solution and ASP.NET Web solution are running in two different environments.

    Can you show a desktop solution that even remotely someone is doing what you are talking about? Show it. That's what I want to see, becuase all you have shown is ASP.NET and Web.config using external files. 

    But I have seen documentation that a WPF solution can be hosted on IIS. And you expect  a WPF XAML solution and some external file scenario is going to work in that environment?

    Sunday, November 25, 2018 5:54 PM
  • User-1158769213 posted

    I already said that I would be happy to see this working in an ASP.NET project as well. Why are you asking about WPF?

    I even rephrased my question purely in ASP.NET terms, specifically mentioning that I have a web.config file that I would like to modify to include an external file. That doesn't work, despite being documented in MSDN. Forget WPF for the moment, please read my rephrased question and see if you can answer that.

    Sunday, November 25, 2018 5:58 PM
  • User475983607 posted

    I built a simple demo using the WCF service template and a console app.  configureSource  just works.

    App.config

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
      </startup>
    
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_IDemoService" />
          </basicHttpBinding>
        </bindings>
        <client configSource="client.config">
        </client>
      </system.serviceModel>
    </configuration>

    client.config

    <?xml version="1.0" encoding="utf-8" ?>
    <client>
      <endpoint address="http://localhost:49351/DemoService.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IDemoService" contract="DemoServiceRef.IDemoService"
        name="BasicHttpBinding_IDemoService" />
    </client>

    I had to set the the client.config properties in solution explorer to copy client.config to the bin directory.

    Perhaps build a demo solution and see if that works.  Otherwise, post your solution(s) so we can see what you have.

    Sunday, November 25, 2018 5:59 PM
  • User1120430333 posted

    I already said that I would be happy to see this working in an ASP.NET project as well. Why are you asking about WPF?

    And I am telling you that it works in ASP.NET Web based solutions.

    Where did I get WPF? That was your opening statement below  in your opening post, which I never deviated from it, becuase it is a  given that external files work in Web.config using ASP.NET.

    I have a WPF project (.NET 4.5 if it makes any difference) in VS2017, which has a whole pile of code in the app.config file that I would like to move into a separate file.

    Sunday, November 25, 2018 6:09 PM
  • User1120430333 posted

    I had to set the the client.config properties in solution explorer to copy client.config to the bin directory.
    Perhaps build a demo solution and see if that works. Otherwise, post your solution(s) so we can see wh

    I am curious as to what is going to happen when you deploy the console program to another machine. Is the console program's runtime config of programname.exe.config that .NET is looking at during runtime is even going to recognize  the external file? 

    Sunday, November 25, 2018 6:16 PM
  • User-1158769213 posted

    I built a simple demo using the WCF service template and a console app.  configureSource  just works.

    I tried this in a new ASP.NET project and despite VS underlining the configSource attribute and claiming it is not allowed, the project ran fine and I could read the data from the included file.

    So, it looks like it's something specific to my projects. Trouble is, I wouldn't know where to start working out what. The projects themselves are pretty big, and are also not mine to distribute publicly, so I can't share the whole code base.

    Any idea where I should look to see why this isn't working for me? The projects are using System.Web.Mvc version 5.2.3.0 if that helps.

    Thanks

    Sunday, November 25, 2018 6:25 PM
  • User475983607 posted

    DA924

    I am curious as to what is going to happen when you deploy the console program to another machine. Is the console program's runtime config of programname.exe.config that .NET is looking at during runtime is even going to recognize  the external file? 

    The .NET run time looks in the bin directory or a path relative to the bin directory for the configuration file include as explained in the linked docs.

    If you are deploying the app to a desktop then you need to include the config files with the deployment.

    Sunday, November 25, 2018 6:31 PM
  • User475983607 posted

    mgebhard

    I built a simple demo using the WCF service template and a console app.  configureSource  just works.

    I tried this in a new ASP.NET project and despite VS underlining the configSource attribute and claiming it is not allowed, the project ran fine and I could read the data from the included file.

    So, it looks like it's something specific to my projects. Trouble is, I wouldn't know where to start working out what. The projects themselves are pretty big, and are also not mine to distribute publicly, so I can't share the whole code base.

    Any idea where I should look to see why this isn't working for me? The projects are using System.Web.Mvc version 5.2.3.0 if that helps.

    Thanks

    We cannot solve the problem if we cannot reproduce the issue.  

    Anyway, the SectionInformation.ConfigSource property (attribute) has been around since the 2.0 Framework.  

    Sunday, November 25, 2018 6:42 PM
  • User-1158769213 posted

    The .NET run time looks in the bin directory or a path relative to the bin directory for the configuration file include as explained in the linked docs.

    If you are deploying the app to a desktop then you need to include the config files with the deployment.

    So are you saying that this should work in any .NET project, not just ASP.NET? That's the impression I got from what I read, but was beginning to doubt it.

    Either way, I can't it to work in any .NET project I've tried. As I said, I have a WPF project and two ASP.NET ones, and get a run-time exception if I try to use configSource in any of their config files (web.config for the ASP.NET projects and app.config for WPF).

    Any ideas? Thanks

    Sunday, November 25, 2018 6:44 PM
  • User-1158769213 posted

    We cannot solve the problem if we cannot reproduce the issue.  

    I realise that, which is why I asked if you had any ideas what I should look for to find the problem.

    Anyway, the SectionInformation.ConfigSource property (attribute) has been around since the 2.0 Framework. 

    Which makes it even more odd that it doesn't work in any of these projects.

    Any ideas how I find out what the problem is?

    Sunday, November 25, 2018 6:46 PM
  • User1120430333 posted

    DA924

    I am curious as to what is going to happen when you deploy the console program to another machine. Is the console program's runtime config of programname.exe.config that .NET is looking at during runtime is even going to recognize  the external file? 

    The .NET run time looks in the bin directory or a path relative to the bin directory for the configuration file include as explained in the linked docs.

    If you are deploying the app to a desktop then you need to include the config files with the deployment.

    Yes, I know this. And I would assume the external.config would need to be deployed somewhere too with  pathing to the external file, becuase otherwise, it would not be found. To me,  it makes no sense to have this external file situation on  the Windows desktop solution, becuase it's just more complications  just use one config file.

    Sunday, November 25, 2018 7:00 PM
  • User-1158769213 posted

    To me,  it makes no sense to have this external file situation on  the Windows desktop solution, becuase it's just more complications

    Not sure why you think it's so complicated. Assuming I could get the whole include bit to work (in any client project, whether ASP.NET or WPF), it would be as simple as adding the external file as a link in the client project, then setting it to copy to the output folder. That way it will appear in the bin folder of the client project, and could be found by the include. Avoids the issue of having duplicate data in three separate projects.

    Sunday, November 25, 2018 7:06 PM
  • User1120430333 posted

    Yossu

    DA924

    To me,  it makes no sense to have this external file situation on  the Windows desktop solution, becuase it's just more complications

    Not sure why you think it's so complicated. Assuming I could get the whole include bit to work (in any client project, whether ASP.NET or WPF), it would be as simple as adding the external file as a link in the client project, then setting it to copy to the output folder. That way it will appear in the bin folder of the client project, and could be found by the include. Avoids the issue of having duplicate data in three separate projects.

    There is no Bin folder on deployment of the solution to another machine, unless you make a Bin folder for the solution off of C:\Program Files or anyother directory on a machine somewhere. The whole purpose is to NOT be running the program in Visual Stuido on a client machine.

    Mt view on complications  is that things could easily break on the desktop program deployment becuase of  this external file stuff,  and I wouldn't want the headache  of trying to figure out that it broke, becuase of config file issues, when the whole config info can be in one config file. 

    Sunday, November 25, 2018 7:18 PM
  • User475983607 posted

    DA924

    Yes, I know this. And I would assume the external.config would need to be deployed somewhere too with  pathing to the external file, becuase otherwise, it would not be found. To me,  it makes no sense to have this external file situation on  the Windows desktop solution, becuase it's just more complications  just use one config file.

    It's common in professional development shops to separate solution configurations; dev, test, prod.

    Sunday, November 25, 2018 7:41 PM
  • User475983607 posted

    There is no Bin folder on deployment of the solution to another machine, unless you make a Bin folder for the solution off of C:\Program Files or anyother directory on a machine somewhere. The whole purpose is to NOT be running the program in Visual Stuido on a client machine.

    Mt view on complications  is that things could easily break on the desktop program deployment becuase of  this external file stuff,  and I wouldn't want the headache  of trying to figure out that it broke, becuase of config file issues, when the whole config info can be in one config file. 

    The bin folder is simply the target in VS.  The actual deployed folder can be whatever name you like.  I should rephrase my earlier comment to the framework uses the current running directory.

    Sunday, November 25, 2018 7:50 PM
  • User475983607 posted

    Any ideas how I find out what the problem is?

    I'm not sure.  

    Sunday, November 25, 2018 7:52 PM
  • User1120430333 posted

    DA924

    Yes, I know this. And I would assume the external.config would need to be deployed somewhere too with  pathing to the external file, becuase otherwise, it would not be found. To me,  it makes no sense to have this external file situation on  the Windows desktop solution, becuase it's just more complications  just use one config file.

    It's common in professional development shops to separate solution configurations; dev, test, prod.

    Yeah, but most of the time,  any config file is left in the code repository, and the one on the developer's desktop for the desktop program is pretty much static, just like it's going to be static on a QA's  desktop machine  running the program or any desktop client machine hitting the production environment running the program that the config file is static.

    So,  someone is going to approve of this for a desktop solution this external config file headache that could come to flourishion easily? I don't think so, at least from my past experiences is dealing with config files in this scenario of multiple environments the desktop solution on a machine can be running against. 

    Sunday, November 25, 2018 8:06 PM
  • User1120430333 posted

    DA924

    There is no Bin folder on deployment of the solution to another machine, unless you make a Bin folder for the solution off of C:\Program Files or anyother directory on a machine somewhere. The whole purpose is to NOT be running the program in Visual Stuido on a client machine.

    Mt view on complications  is that things could easily break on the desktop program deployment becuase of  this external file stuff,  and I wouldn't want the headache  of trying to figure out that it broke, becuase of config file issues, when the whole config info can be in one config file. 

    The bin folder is simply the target in VS.  The actual deployed folder can be whatever name you like.  I should rephrase my earlier comment to the framework uses the current running directory.

    You don't have to explain what the  Bin folder is about. I know what the Bin folder is about from all aspects.

    Sunday, November 25, 2018 8:08 PM