简体   繁体   中英

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.

  • 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM