我在 Visual Studio 2008 中使用Web 部署项目来准备我的 ASP.NET 应用程序(ASP.NET Web 应用程序,不是 ASP.NET 网站)用于复制到多个服务器。 我必须将文件复制到本地临时服务器、通过 FTP 复制到不同的服务器上,有时我必须从客户的服务器上获取它们。
因此,最好以紧凑的形式部署所有文件,而无需在源和目标之间进行大量比较。 Web 部署项目有一个很好的功能:将所有 aspx 和 ascx 文件编译成单个(附加)程序集。
我以某种方式发现如何删除服务器上的 aspx 占位符文件,现在我想知道是否有一种(也许是自制的)方法来删除这些文件.compiled
文件。
来自 Rick Strahl 的博客:
.Compiled 文件是一个标记文件
对于 Web 中的每个页面和控件
站点并标识所使用的类
装配体内部。 这些文件
不是可选的,因为它们映射 ASPX
页面到适当的预编译
预编译程序集中的类。
如果删除 .Compiled 文件,
它映射的页面将无法访问
执行,你会得到一个令人讨厌的执行结果
错误。
有人有创意,也许可以使用模块/处理程序来拦截对 bin 文件夹中的 .compiled 文件的检查?
I'm using a Web Deployment Project in Visual Studio 2008 in order to prepare my ASP.NET application (ASP.NET web application, not ASP.NET web site) for being copied to several servers. I have to copy the files on local staging servers, on different servers via FTP and sometimes I have to fetch them from customers' servers.
So, it would be nice to have all files for deployment in a compact form without the necessity of doing a lot of comparing between source and destination. Web deployment projects have this nice feature: compile all your aspx and ascx files into a single (additional) assembly.
I somehow found out how to get rid of aspx placeholder files on the server, now I'd like to know if there is a (maybe self-made) way to get rid of these .compiled
files.
From Rick Strahl's blog:
The .Compiled file is a marker file
for each page and control in the Web
site and identifies the class used
inside of the assembly. These files
are not optional as they map the ASPX
pages to the appropriate precompiled
classes in the precompiled assemblies.
If you remove the .Compiled file, the
page that it maps will not be able to
execute and you get a nasty execution
error.
Anybody out there with a creative idea, maybe using a module/handler which intercepts the check against the .compiled
files in the bin folder?
发布评论
评论(8)
.compile 文件来自部署时的预编译。 因此,您基本上有 3 个选择:
我自己也遇到过同样的问题。 实际上,在处理网站部署时,我在大多数情况下选择#1,但在极少数情况下,当我知道我将不得不长时间维护该网站时,我会花时间将其升级为 Web应用。
The .compile file comes from pre-compiling on deployment. So you basically have 3 options:
I have run in to the same problem myself. I actually choose #1 in most cases when dealing with deployment of Web Sites, but on the rare occasion when I know I am going to have to maintain the site for an extended period of time, I take the time to upgrade it to a Web Application.
我也不喜欢 .compiled 文件,但如果它们在那里,没有人会受到伤害。 那为什么还要麻烦呢?
I don't like the .compiled files either, but nobody gets hurt if they're there. So why bother?
您可能需要查看虚拟路径提供程序< /a>(知识库文章此处)在 ASP.NET 中。
此建议的功劳必须归功于 Cheeso 和他在这里自我回答的问题:
You might want to take a look at Virtual Path Providers (KB how to here) in ASP.NET.
Credit for this suggestion must go to Cheeso and his self answered question here:
我不知道 .compiled 文件,但您可以将服务器设置为使用 subversion 更新其文件,而不是在编译时手动复制文件。
因此,您可以使用 Web 部署项目(而不是单个程序集)编译文件,将它们放入为此目的创建的存储库中,然后在每台服务器上执行 svn update 来自动获取和比较文件。
我知道这不是你直接要求的,但这可能是一条探索之路。
I don't know about the .compiled files, but you could set up your servers to update their files with subversion instead of manually copying the files when you compile.
So you would compile the files using the Web deployment project (not into a single assembly), put them in a repository you created for this purpose, and on each server, just do an svn update to fetch and compare the files automatically.
I know it's not what you asked for directly, but it may be a path to explore.
将“排除过滤器”添加到您的部署项目:
就是这样。
Add "Exclude Filter" to your deployment project:
and thats it.
我记得当我无法使用 VWD Express 进行 Web 应用程序时,我使用 nant 脚本将项目编译成单个 dll 并部署,这样就可以了(所以我也不需要完整的 VS 来进行 dll 部署),所以如果你真的不想把你的项目弄乱到Web应用程序,也许这也是一个需要检查的路径。
I remember at the days when I cant do Web Application with VWD Express, I use nant script to compile the project into a single dll and deploy, that would work (so I dont need the full VS to do dll deployment too), so if you really don't want to mess your project to Web Application, maybe this is a path to check too.
您可以使用 .compiled 文件>aspnet_merge 工具,带有
-r
选项。You can get rid of the
.compiled
files by using the aspnet_merge tool with the-r
option.如果您将代码发布为可更新(在发布设置中),则会生成这些文件。 取消选中该值并重新发布。 这是我知道的一个老问题,但这里没有明确定义答案。
If you publish your code as updateable (in publish settings) these files are generated. Uncheck that value and republish. This is an old question I know, but no answers are clearly defined for this here.