我有一个使用 Hudson 通过命令行构建的 Visual Studio 2010 MVC2 Web 应用程序.我想让 Hudson 发布一个 Web 输出,所以我在命令行中添加了 DeployOnBuild=true 和 CreatePackageOnPublish=True 标记.
I have a Visual Studio 2010 MVC2 web application that I'm building via the command line using Hudson. I'd like to make Hudson publish a web output, so I added the DeployOnBuild=true and CreatePackageOnPublish=True tags to my command line.
我的命令是:
C:WindowsMicrosoft.NETFrameworkv4.0.30319MSBuild.exe
/target:Clean,Build
/property:Configuration=Debug;DeployOnBuild=True;CreatePackageOnPublish=True;
[my project name.csproj]
在我的开发机器 (Windows 7) 上运行此命令会成功将 Web 输出发布到 objDebugPackagePackageTmp
.但是在 Hudson 服务器 (WS 2008) 上运行它会成功编译,但它不会发布.相同的命令,相同的 MSBuild 版本,相同的源代码.
Running this command on my development machine (Windows 7) successfully publishes a web output to objDebugPackagePackageTmp
. But running it on the Hudson server (WS 2008) compiles successfully, but it doesn't publish. Same command, same version of MSBuild, same source code.
我尝试了 /t:Publish
目标,它给了我一个 Skipping Unpublishable Project 响应,正如我在其他几个人的帖子中看到的那样.
I've tried the /t:Publish
target, which gives me a Skipping Unpublishable Project response, as I've seen on several other people's posts.
我已经尝试将 DeployOnBuild=True
和 CreatePackageOnPublish=True
标签也添加到我的项目文件中,但没有任何变化.
I've tried adding the DeployOnBuild=True
and CreatePackageOnPublish=True
tags to my project file as well, and no change.
对为什么不发布有任何想法吗?我是否错误地使用了这些标签?我确定这里有一些我没有看到的东西.
Any thoughts on why this isn't publishing? Am I using these tags incorrectly? I'm sure there's something here that I'm just not seeing.
假设您没有在您的 hudson 服务器上安装了 Visual Studio 2010,那么您可能缺少发布目标""文件.经过多次面对面的敲打,我终于解决了这个问题.
Assuming you do not have Visual Studio 2010 installed on your hudson server, then it may be that you are missing the publishing "targets" file. After a lot of head-to-desk banging, I finally solved this.
很长一段时间我都知道我需要复制目录
For quite a while I have known that I needed to copy the directory
C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0WebApplications
C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0WebApplications
从装有 VS2010 的本地机器到我的服务器,以便让项目构建.但要让项目也发布,我还需要复制目录
from my local machine with VS2010 to my server in order to get the project to build. But to get the project to also publish I needed to also copy over the directory
C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0Web
C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0Web
注意:在我的情况下,我实际上是将这些文件夹提交到我的源代码管理并更改我的 csproj 文件中的 <MSBuildExtensionsPath32>
值以指向这些签出的文件夹(所以少了一个准备服务器时的步骤).这不是让它工作的必要条件,但您可能需要在解决问题后考虑这一点.
Note: In my case I am actually committing those folders to my source control and changing the <MSBuildExtensionsPath32>
value in my csproj file to point to these checked out folders (so there is one less step when prepping a server). This isn't necessary to get it to work, but you may want to consider this after you solve your issue.
更新:所以在我完成上述操作后,构建抱怨它找不到Microsoft.Web.Deployment.dll".为了解决这个问题,我需要在服务器上安装 Microsoft Web Deploy v2.0 即使我只是发布到文件系统.我想我可以看到其中的逻辑.
UPDATE: So after I did the above, the build complained that it could not find "Microsoft.Web.Deployment.dll". To solve this I needed to install Microsoft Web Deploy v2.0 on the server even though I am only publishing to the file system. I guess I can see the logic in this.
更新:我发现通过 IIS Web 平台安装程序安装Visual Studio 2010 Shell(集成)"将安装所需的构建目标.这似乎是在您的服务器上不安装整个 Visual Studio 应用程序和不手动将看似任意的文件夹从您的开发机器复制到您的服务器之间的一个很好的折衷方案.
UPDATE: I have discovered that installing "Visual Studio 2010 Shell (Integrated)" through the IIS Web Platform Installer will install the required build targets. This seems like a nice compromise between not having the entire Visual Studio application installed on your server and not manually copying seemingly arbitrary folders to your server from your dev machine.
这篇关于MSBuild DeployOnBuild=true 不发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!