为什么 Visual Studio 2010 发布带有源代码的网站? [英] Why Visual Studio 2010 publish website with source code?

查看:53
本文介绍了为什么 Visual Studio 2010 发布带有源代码的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Visual Studio 2010 与新网站发布对话框一起使用.我有一个 Web 应用程序网站.发布时,理论上它应该将所有代码编译成一个程序集.但是,在 DebugRelease 中,发布目录后始终包含页面和用户控件的源代码(即使使用未转换的 web.config 文件 Web.Debug.config 和Web.Release.Config).这很令人困惑.

I'm using Visual Studio 2010 with the new website publish dialog. I have a Web Application website. When published, in theory it should compile all the code into an single assembly. However, in both Debug and Release, after publishing the directory always contains source code of page and user controls (even with the untransformed web.config files Web.Debug.config and Web.Release.Config). This is very confusing.

但是使用 package/publish web 项目配置和 Generate Deploy package 上下文菜单项,Package\PackageTmp 目录是干净的.

But with package/publish web project configuration and Generate Deploy package context menu item, the Package\PackageTmp directory is clean.

  • 为什么 Visual Studio 不使用此包来发布网站?
  • 预编译选项在哪里?
  • Web.config xml 转换好像不行,为什么 Visual Studio 带来这个功能让我迷惑?

推荐答案

正确的答案是查看打包/发布 Web 设置(在 Web 应用程序项目属性中)并查找要部署的项目".

The correct answer is to look in the Package/Publish Web settings (in the web application project properties) and look for the "Items to deploy".

对于 Web 应用程序,您希望部署的项目"具有仅运行此应用程序所需的文件",它不会复制源代码文件,因为它们已被编译到 bin 文件夹中的 DLL 中.

For a web application you'd want "Items to deploy" to have "Only files needed to run this application" which would NOT copy the source code files, since they've been compiled into the DLL in the bin folder.

请注意,此设置因您当前的构建类型(调试/发布/等)而异,因此请相应地计划...

Note that this setting varies for your current Build type (Debug/Release/etc), so plan accordingly...

呸!

这篇关于为什么 Visual Studio 2010 发布带有源代码的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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