问题描述
这是VS 2008和.NET 3.5。
This is VS 2008 and .Net 3.5.
我使用自定义部署项目的脚本这是类似于发布右键菜单,但我已定制做文件重命名以及其他各种零零碎碎。它的作品真的很好,并大大简化了释放过程。
I use a custom deployment project script which is similar to the publish right-click menu, but which I have customised to do file renaming and various other bits and pieces. It works really well and has drastically simplified the release procedure.
我意识到一个问题,对我们的生活的一个网站本周末本来pvented曾在现场被precompiled(长的故事)。$ P $
I was made aware of an issue on one of our live sites this weekend that would have been prevented had the site been precompiled (long story).
所以,我一直在玩弄注入AspNetCompiler MSBuild任务(使用PhysicalPath属性直接朝中间发布的文件夹)到部署脚本,我就'VirtualPath'选项的问题。
So I've been playing around with injecting the AspNetCompiler MSBuild Task (using the PhysicalPath attribute to direct towards the intermediate publish folder) into the deployment script and I have a question regarding the 'VirtualPath' option.
尽管该网站是不是在IIS中在这个pre-部署阶段,你仍然需要提供的'VirtualPath属性的值。我所看到的这里上aspnet_compiler.exe相关-v选项使用此值在解决编译过程中使用的整个网站'〜'根虚拟路径。
Despite the fact that the website is not in IIS at this pre-deploy stage, you are still required to provide a value for the 'VirtualPath' attribute. I have seen here that the associated -v switch on aspnet_compiler.exe uses this value in resolving '~' rooted virtual paths used throughout the site during the compilation.
所以,我认为这意味着,无论你路过这里的必须在应用程序的虚拟根在部署否则将无法正常工作。
So, I take this to mean that whatever you pass here must be the virtual root of the application when deployed otherwise it won't work.
不过,我已经试过了这一点,通过像/假/假'这个选项,然后改变了我的母版页中的一个,通过一个应用程序层次的网址,而不是相对于引用的CSS,它仍然工作即使部署到/网站'而不是'/ fake /假的。
However, I've tried this out, passing something like '/fake/fake' in this option and then changing one of my master pages to reference a css via an app-rooted url instead of relative, and it still worked even when deployed to a virtual path of '/site' and not '/fake/fake'.
那么,什么是对这个明确的答案?我是否需要担心这个VirtualPath值是正好等于在IIS站点的最终部署的位置?我希望不会,因为我真的不希望我的部署计划有目标Web服务器的虚拟层次结构的任何知识,以防它需要改变。
So what's the definitive answer on this? Do I need to worry about this VirtualPath value being exactly equal to the eventual deployed location of a site in IIS? I hope not, because I don't really want my deploy project to have any knowledge of the virtual hierarchy of the target web server, in case it needs to change.
推荐答案
我已经分析了code是precompiled和它似乎是在precompiler自动解析到应用程序根路径相对路径反正不管你怎么也设置VirtualPath的。我也试着部署相同的pre-编译现场不同的虚拟路径上的目标服务器并没有什么休息时间。
I've analyzed the code that is precompiled and it would seem that the precompiler automatically resolves the application-rooted paths to relative paths anyway, regardless of what you set the VirtualPath too. I've also tried deploying the same pre-compiled site to different virtual paths on the target server and nothing breaks.
因此,因此我有足够的信心可以说:没有不要紧这是什么值
So therefore I'm confident enough to be able to say: no it does not matter what this value is.
毫无疑问,我们不可避免要的东西我可能错过了! - 但直到我证明是错误的,我会认为我是对的。
No doubt there's bound to be something I've potentially missed - but until I'm proved wrong I'll assume I'm right!
这篇关于VirtualPath在AspNetCompiler MSBuild任务 - 它必须等于最终部署的虚拟路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!