how to exclude app.config from setup deployment pr

2019-08-01 15:48发布

问题:

How to exclude app.config from setup deployment project?

I must maintain encrypted sections in app.config and the only (semi) embeded way I know is by running code with RsaProtectedConfigurationProvider or DPAPI provider. Since I have to run that code the question arises: when to run it. Since there seem to be some problems using Rsa under windows 7 (some end user's will NOT have admin rights on it) I concentrated on DPAPI which is machine dependent. Therefore I can not encrypt app.config on my developer machine. So I have to do it on a target machine. If application does not find any config files, then it creates one. And that's what I am trying to do: to exclude app.config from msi setup project, so that whe app is run for the first time, settings are created from defaults and my encryption code runs on it. Hope I was clear enough.

回答1:

In the Setup Deployment project you could for the Primary Output folder enter in the Exclude property: app.config



回答2:

In Visual Studio, could you change the app.config -> properties -> Build Action from "Content" to "None"?