Web 部署项目是否适用于 x86 构建配置
我需要构建一个网站和它在 x86 配置中引用的几个 DLL。迄今为止,我们一直在使用 Web 部署项目来创建结果站点的 Zip 文件及其所需的所有文件。我们需要继续使用 WDP,但是它们似乎在 x86 构建配置方面存在问题。
在我的项目中,当我在 Release/x86 中构建解决方案时,出现以下错误。
Description File Line Column Project
Error 80 Could not load type 'WwwRooot.Default'. /WwwRooot.csproj/Default.aspx 1 1 WwwRooot.csproj_deploy
Web 应用程序或任何引用的类库没有生成错误或警告。
我认为这可能是我正在从事的项目所特有的,所以为了证明自己是错的,我创建了一个包含 Web 应用程序 (c#) 的解决方案。然后,我使用配置管理器通过复制任何 CPU 配置来创建 x86 配置。我检查了属性页面,确保新配置已设置为构建为 x86,确实如此。我构建的解决方案没有错误。
接下来,我右键单击 Web 应用程序并从上下文菜单中添加了 WDP。 右键单击 WDP 并编辑项目文件。此时,我将 AnyCPU 的所有引用更改为 x86,以便 WDP 具有 x86 构建的条件。 我在 Release/x86 中重建了解决方案,一切都构建得很好。
接下来,我添加一个类库,使用配置管理器为此库创建 x86 配置,添加对该库的 Web 应用程序的引用,然后在 Release/x86 中重建所有内容,我收到与上面详述的相同的错误。
WDP 是否与 x86 版本兼容?
如果我删除类库(和引用),则解决方案(包括 WDP)可以正常构建。
我在 64 位 Windows 7 Pro 上使用 Visual Studio 2008 SP1,并安装了适当的 WDP。
I have a need to build a website and several DLLs that it references in an x86 configuration. To date we have been using Web Deployment Projects to create Zip files of the resultant site and all it's required files. We need to continue to use WDPs however, they seem to have problems with the x86 build configuration.
In my project, when I build the solution in Release/x86 I get the following error.
Description File Line Column Project
Error 80 Could not load type 'WwwRooot.Default'. /WwwRooot.csproj/Default.aspx 1 1 WwwRooot.csproj_deploy
There are no build errors or warnings from the web application or any of the referenced class libraries.
I thought this might be something specific to the project I'm working on so to prove myself wrong I created a solution containing a Web Application (c#). I then used the Configuration Manager to create the x86 configuration by copying the Any CPU config. I checked the properties page an made sure the new config was set to build to x86, and it was. I built the solution without error.
Next I right clicked the Web App and added a WDP from the context menu.
Right clicked on the WDP and edited the project file. At this point I changed any references for AnyCPU to x86 so that the WDP has conditions of x86 build.
I rebuilt the solution in Release/x86 and everything builds fine.
Next I add a Class Library, use Configuration Manager to create an x86 config for this library, add a reference to the web app for the library and then rebuild all in Release/x86 and I receive the same error as detailed above.
Are WDPs compatible with x86 build?
If I remove the Class Library (and the reference) the solution (including the WDP) builds fine.
I am using Visual Studio 2008 SP1, with the appropriate WDPs installed, on 64Bit Windows 7 Pro.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
开箱即用的 Web 部署项目 (WDP) 不适用于 x86 或 x64 构建配置。这是因为在其中一种配置下构建的 Web 应用程序将生成的程序集输出到不同的位置,并且 WDP 不知道在那里查找 DLL。
您需要执行一些操作才能使 WDP 与您的 x86 配置配合使用。
首先,您的 WDP 可能没有 x86 配置,您需要创建一个。使用 Visual Studio 中的 XML 编辑器(或任何文本编辑器)编辑部署项目,在文件顶部附近将看到一个带有条件
标记(通常是第二个) >Debug|AnyCPU 像这样:复制整个标签并将配置更改为
Debug|x84
:现在保存文件并打开配置管理器(构建菜单 > 配置管理器)并检查您的部署项目现在是否具有 x86 配置。
现在,使用文本编辑器编辑 Web 应用程序项目文件,并在
Debug|x86
配置中找到outputPath
元素。它的值应为Bin\x86\Debug
。这需要更改为Bin
:保存、关闭并重新加载您的 Web 应用程序项目。现在,我们已指示 Web 应用程序将其 DLL 放置在 WDP 期望找到的位置。
将构建配置设置为 x86 并构建项目。
冲洗并重复发布和您可能拥有的任何其他构建配置。
Out of the box, Web Deployment Projects (WDP) don't work with x86 or x64 build configurations. This is because a Web Application built under one of these configurations outputs the resultant assemblies in a different place and the WDP doesn't know to look there for the DLLs.
There are a few things you'll need to do to get the WDP working with your x86 configuration.
Firstly, your WDP probably doesn't have an x86 configuration, you'll need to create one. Edit the deployment project using the XML editor in Visual Studio (or any text editor), near the top of the file will see a
<propertyGroup>
tag (usually the second one) with a conditionDebug|AnyCPU
like so:Duplicate this whole tag and change the configuration to be
Debug|x84
:Now save the file and open the configuration manager (Build menu > Configuration manager) and check your deployment project now has an x86 configuration.
Now edit the Web Application Project file using your text editor and locate the
outputPath
element within theDebug|x86
configuration. It should have a value ofBin\x86\Debug
. This needs changing toBin
:Save, close and reload you Web Application Project. We've now instructed the Web Application to put it's DLLs where the WDP expects to find them.
Set your build configuration to
x86
and build the project.Rinse and repeat for Release and any other build configurations you might have.
试试这个
将此命令放入您的 Web 项目的编译后事件中
此命令会将文件从 bin\x86\Debug 复制到 bin
它将与发布配置一起使用
Try this
Put this command in post compilation events of your web project
This command wil copy files from bin\x86\Debug to bin
It will work with Release configuration