Search code examples
vb.netsqliteapp-config

Getting rid of App.exe.config


I am working on a vb.net application that uses SQLite and since it was compiled against the version 2 of the .net framework, i added this line to my config file

<startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

My final objective for the application is to make it a standalone, so not a single file except the exe (well the application will generate a file for the database, but my point is i want the user to only download 1 single file).

And i noticed that when i build it, the config file is always copied, and if i run the application without the config file, i would get the uncaught exception "legacy" error..

Is there any way to either include that config during runtime? or perhaps catch some type of exception to prevent that dialog from showing up and scaring the user (i know this probably not the best approach)

I have searched and found other similar problems on SO but none of the questions i found got to a solution that worked for me so i would appreciate your help.


Solution

  • While it is possible to set the legacy runtime policy at runtime, I would recommend deploying as an installer.

    well the application will generate a file for the database, but my point is i want the user to only download 1 single file

    They could download your installer, which could take care of setting up everything correctly. This is likely to be required in any case, as SQLite will need its own DLLs as well as your .exe to be there in the deployment.