How do I compile my App.config into my exe in a VS2010 C# console app?

前端 未结 10 1935
傲寒
傲寒 2020-12-05 17:24

I\'m creating a console app in Visual Studio 2010 with c#. I want this app to be stand alone, in that all you need is the exe, and you can run it from anywhere. I also want

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-05 18:00

    You can't. Half the point of such config files is to allow changes to the configuration of the app outside of the app itself.

    You would simply have to modify your program so that it didn't have a dependency on the app config file -- easiest way to do that would be to just stick the values inside your config into read only global variables.

提交回复
热议问题