Web application will not publish without .cs files

I have an asp.net web application project that I publish through Build> Publish in visual studio 2013. I publish on the file system using the selected pre-compilation option. My project has "Only the files necessary to run this application", which are selected on the "Package / Publish Settings" screen. However, no matter what I do, the .cs (code-behind) and designer.cs files are copied to the output folder at the time of publication.

This project was created using the File> New Project> ASP.NET Web Application function in the visual studio. Then files from the website project were added to the application, and the “convert to web application” command was launched in the build menu. Converting to a web application seems to work fine, but I can't publish it without including .cs files.

What else needs to be done to enable publishing a web application without including code files? Any ideas on what I can look at?

Could there be a solution-level setup that causes this? A new web application was added to an existing solution with about a dozen other projects.

One more note: when I create a new web application with visual studio in a new project and publish with the same settings, it does NOT include .cs files.

I also tried deleting and then creating a new publishing profile.

+6
source share
2 answers

I just fixed it by deleting my old publish profile and creating a new one.

The new one seemed to have the same settings as the old one, but when I published it, it did not copy the .cs files.

Edit: this answer is a lie. There was a difference between the two profiles. The new profile was in the Release configuration.

Edit 2: There is a parameter in the project settings that determines what is published. Select “only files needed to run this application” from the next page.

Publish Settings Page

+5
source

It turns out that I added this line to my csproj file before when I tried to create my project on our build server. Bug fixed:

<Target Name="GatherAllFilesToPublish"></Target> 
0
source

Source: https://habr.com/ru/post/969353/


All Articles