为什么我需要AspNetCompiler任务的VirtualPath属性 [英] Why do I need VirtualPath property for AspNetCompiler task

查看:137
本文介绍了为什么我需要AspNetCompiler任务的VirtualPath属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为网站编写构建系统,以便可以一键构建.我从源代码存储库中获得了代码的干净副本,然后使用msbuild运行AspNetCompiler任务来为网站进行所有预编译.

让我感到困惑的是,我需要指定一个VirtualPath或MetabasePath.我没有配置数据库路径-我只想将其编译到本地目录中,然后可以将其部署到所选的任何服务器(即,首先是开发服务器,然后是活动服务器).

VirtualPath很棘手,因为我希望将相同的代码可部署到多个位置-该代码使用一些上下文和配置详细信息来计算其SiteID以显示不同的信息-因此指定单个虚拟路径似乎并不明智. /p>

还有其他类似的问题(例如解决方案

在Visual Studio中发布网站时,不需要输入此数据(实际上,我什至从未见过任何选择).我很惊讶在MS-Build配置中它是强制性的.

您可能想对Visual Studio使用的任何东西进行反向工程",但我想这将是单个斜杠"/"或类似的东西.

话虽如此,该要求可能与VirtualPath in AspNetCompiler MSBuild Task - does it have to be equal to the final deployed Virtual Path? ) but the only answers I've found seem to be more anecdotal - ie they jsut say it seems to make no difference in their experience.

However, I can't believe that it really makes no difference. There must be some situation in which this is used or else it wouldn't be there and wouldn't be required.

So does anybody know (and preferably have a reference) for what this does? What problems might be caused by passing a made up virtual path into the task?

解决方案

When publishing a site in Visual Studio, it is not required to enter this data (in fact, I have never even seen any option to). I'm surprised it is mandatory in an MS-Build configuration.

You might want to "reverse engineer" whatever Visual Studio uses but my guess is it will be a single slash "/" or something like that.

Having said that, the requirement might have something to do with the issues around precompiled websites using Virtual Path Providers or Resource Providers.

这篇关于为什么我需要AspNetCompiler任务的VirtualPath属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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