VictorySaber
VictorySaber

Reputation: 3164

Visual Studio - how to mark file/folder in MVC project as Do Not Publish?

In my MVC project I have a folder called Documents and inside that are some .txt files. These have information relating to the inner workings of the website and one document has usernames & passwords (for the dev database, not live).

When I publish to the server this folder gets copied up, which I do not want. In its properties, "Copy To Output Directory" is set to "Do not copy" but it still gets copied.

In another project the Documents folder is in the Repository layer which compiles into a DLL and I don't see the folder or txt files on the server. The MVC project where I am having the issue doesn't have a layered architecture. I could create a class library project for it but that seems silly.

Upvotes: 0

Views: 554

Answers (1)

Nirman
Nirman

Reputation: 6793

  • Set "Build Action" property of the file to "None".
  • You have already set the "Copy to Output Directory" to "Do not copy", so that is already covered.
  • Right-click your MVC project in the solution explorer. Click "Package/ Publish Web", and make sure to select "Items to deploy" to "Only files needed to run this application" option.

Upvotes: 1

Related Questions