Domanda

We use a local config file with database connection strings, in the event we need to hook our local computer up to the development or even production database. We call this file ConnectionStrings.local.config and it's included in our C# project so we can edit it easily.

I don't want this file to be included when I go to the publish web tool, since we are going to use config transforms that will swap out the connection strings property for the real data source on each server.

I modified my .csproj file as follows:

Exclude

but the ConnectionStrings.local.config file still shows up in the folder after being published.

How can I remove it from deployment without excluding the file from Visual Studio?

È stato utile?

Soluzione

In the property window of the given file (from Visual Studio), set "Copy to Output Directory" to "Do Not Copy", and be sure "Build Action" is "None."

Also, did you clear out your DESTINATION directory first? Perhaps the file was left there from your previous publish? By default, publishing will not "clean" the destination directory.

Altri suggerimenti

To exclude a file 1. In Solution Explorer, select the file that you want to exclude. 2. In the Properties window, select the Exclude property and set it to true.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top