简体   繁体   English

Visual Studio 2013发布问题

[英]Visual Studio 2013 Publish issue

I converted a VS2010 ASP.Net MVC3 project to VS2013 MVC4. 我将VS2010 ASP.Net MVC3项目转换为VS2013 MVC4。 Now when I publish, it is copying the contents of my project to the bin folder. 现在,当我发布时,它将项目的内容复制到bin文件夹中。

在此处输入图片说明

I can't understand what I did to make it do this..How do I fix it so it doesn't do it? 我不明白我做了什么才能做到这一点。如何修复它,使其不起作用?

Your files are incorrectly set to copy to the output folder ( \\bin ) during build. 在构建过程中,文件设置不正确,无法复制到输出文件夹( \\bin )。 Make sure that the Copy To Output setting on each file is set to Do Not Copy . 确保Copy To Output每个文件的“ Copy To Output设置设置为Do Not Copy

Normally, you don't need to copy much of anything to your bin folder. 通常,您不需要将任何东西复制到bin文件夹中。 When publishing, all of the content pages (*.aspx, *.html, *.css, etc) will get picked up by publish just by existing in the project. 发布时,所有内容页面(* .aspx,*。html,*。css等)都将通过发布而仅通过项目中现有的内容来获取。 This is determined by the Build Action being set to Content . 这取决于将Build Action设置为Content (Note: you can exclude files by setting the Build Action to None ) (注意:您可以通过将Build Action设置为None来排除文件)

For code files, there's 2 ways it could go. 对于代码文件,有两种解决方法。 in a Web Application project (which MVC is) most code files, such as controllers, models, or code behind files in WebForms, are compiled into your site's DLL already. 在Web应用程序项目(即MVC)中,大多数代码文件(例如,控制器,模型或WebForms中的文件后面的代码)已被编译到站点的DLL中。 These have Build Action = Compile , meaning they get compiled up front and don't need to be included in the publish. 它们具有Build Action = Compile ,这意味着它们可以预先进行Build Action = Compile ,不需要包含在发布中。 The exception to this is files in App_Code, which are deployed to your site ( Build Action = Content ) and compiled at runtime. 唯一的例外是App_Code中的文件,这些文件已部署到您的站点( Build Action = Content )并在运行时进行编译。 You can also choose to pre-compile your site in the publish settings (Settings -> File Publish Options -> Precompile during publishing), which will process the App_Code files automatically (ie you can leave them as Build Action = Content and VS will compile them and publish the output instead). 您还可以选择在发布设置(设置->文件发布选项->发布期间进行预编译)中预编译您的网站,该设置将自动处理App_Code文件(即,您可以将它们保留为Build Action = Content而VS将进行编译)它们并发布输出)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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