没有.cs文件,Web应用程序将无法发布 [英] Web Application won't publish without .cs files

查看:166
本文介绍了没有.cs文件,Web应用程序将无法发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net Web应用程序项目,我正在Visual Studio 2013中通过构建">发布"发布.我正在使用选定的precompile选项发布到文件系统.我的项目在打包/发布Web设置"屏幕中选择了仅运行该应用程序所需的文件".但是,无论执行什么操作,.cs文件(代码隐藏)和designer.cs文件都会在发布过程中复制到输出文件夹中.

I have an asp.net web application project that I am publishing via Build > Publish within visual studio 2013. I am publishing to the file system, using the precompile option selected. My project has "Only files needed to run this application" selected in the Package/Publish Web settings screen. However, regardless of what I do, the .cs files (code-behind) and designer.cs files get copied to the output folder during publishing.

此项目是通过使用Visual Studio中的文件">新建项目">"ASP.NET Web应用程序"功能创建的.然后,将来自网站项目的文件添加到该应用程序,并从构建菜单在其上运行转换为Web应用程序"命令.转换为Web应用程序似乎运行良好,但是如果不包含.cs文件,我将无法发布.

This project was created by using the File > New Project > ASP.NET Web Application functionality in visual studio. Then files from a website project were added to the application, and the "convert to web application" command was run on it from the build menu. The conversion to a web app seems to have worked fine, but I am unable to publish without the .cs files being included.

要使Web应用程序在不包含代码隐藏文件的情况下发布,还需要做些什么?关于我可以研究的任何想法吗?

What else needs to be done in order to get a web application to publish without the code-behind files included? Any ideas on what I can look into?

在解决方案级别上是否存在引起此问题的设置?新的Web应用程序已添加到包含大约十二个其他项目的预先存在的解决方案中.

Could there be a setting at the solution level that is causing this? The new web application was added to a pre-existing solution with about a dozen other projects.

要注意的另一件事是,当我在新项目中使用Visual Studio创建新的Web应用程序并发布具有相同设置的应用程序时,它不包含.cs文件.

Another thing to note is that when I create a new web app with visual studio in a new project, and publish w/ the same settings, it does NOT include the .cs files.

我也尝试过删除然后创建一个新的发布配置文件.

I've also tried deleting and then creating a new publish profile.

推荐答案

我只是通过删除旧的发布配置文件并创建一个新的配置文件来解决此问题.

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

新文件似乎具有与旧文件相同的设置,但在我发布时并未复制.cs文件.

The new one appeared to have all the same settings as the old one but when I published it didn't copy the .cs files.

这个答案是一个谎言.两种配置文件之间存在差异.新的配置文件处于发布"配置.

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

项目设置中有一个设置可以确定发布的内容.从下一页中选择仅运行该应用程序所需的文件".

Edit 2: There's a setting in the project settings which determines what gets published. Select "only files needed to run this application" from the following page.

这篇关于没有.cs文件,Web应用程序将无法发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆