question

Farkler avatar image
0 Votes"
Farkler asked Farkler answered

How to Prevent Visual Studio from Deleting "Config" files when Performing "Clean Solution"

We recently converted from Visual Studio 2013 to 2019. Our application has an external application that creates the settings to write to a config file on the startup project. I won't go into the details to save space. Anyway, in Visual Studio 2013 we could perform 'clean solution' and the *.config file would not be deleted. In VS 2019 performing a "clean" on the solution deletes the config file, including the config file that has settings contained from the external application. Running the external application to repopulate the config file after every clean is not productive for our development environment.

Does anyone know what can be done in VS 2019 to prevent the config files from being deleted on 'clean solution'? Thanks

dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Farkler avatar image
0 Votes"
Farkler answered

Work around to prevent this issue. In the app.config file added below line of code.

<appSettings file="[unique file name].exe.Config"></appSettings>

The key is a file name that does not match any project name in the solution.

Performing a clean on the solution no longer deletes the file i want to retain between solution clean process.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered Farkler commented

Currently there are no properties or setting to prevent this behavior. You can report this as a problem or provide feed back. Do this via clicking the feedback button, top right corner of Visual Studio.

81287-f1.png



f1.png (7.8 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for the suggestion.

0 Votes 0 ·