Hi @Salik Rafiq ,
Are the files you mentioned included in the solution directory?
I think what you set should be "Copy to output directory", "Copy to output directory" is a property of a file in a Visual Studio project that defines whether the file will be copied as-is to the project's build path. Treating files as-is allows us to use relative paths to files within the project.
If you don't want to publish some files, you need to set <CopyToPublishDirectory> in csproj file.
https://learn.microsoft.com/en-us/answers/questions/172352/how-can-i-include-different-files-when-publishing.html
You can also right-click a folder > Exclude from Project. Then delete the old publish profile and create a new publish profile for publishing.
When you publish your website, Visual Studio compiles all your cs/vb/class code into binaries (dll). This dll file can be found in your site bin folder.
Do you build your project before publishing?
You can also choose to publish only a single file according to your needs, and you can view the document for specific steps.
https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=vs#publish-a-single-file-app
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.