Lightswitch - 在 TeamCity 中构建它
我正在尝试将 Lightswitch 项目放入 Teamcity 中,并尝试了以下运行程序类型:
- Visual Studio (sln)
- MSBuild
- 命令行(通过命令行运行 MSBuild)
在构建 Lightswitch 解决方案时,所有 3 种运行程序类型都给了我相同的错误:
“UnpackExtensionsToProjectDir”任务意外失败。 System.NullReferenceException:未将对象引用设置为对象的实例。
Lightswitch 已安装在服务器上。已尝试在服务器上使用 Visual Studio 手动构建解决方案,并且构建得很好。还尝试通过命令行(使用 MSBuild)构建解决方案,它也构建得很好。
想问一下是否有人能够在 TeamCity 上很好地构建 Lightswitch。干杯。
I'm trying to get a Lightswitch Project into Teamcity and have tried the following runner types:
- Visual Studio (sln)
- MSBuild
- Command line (ran MSBuild through the command line)
All 3 runner types gave me the same error when building the Lightswitch solution:
The "UnpackExtensionsToProjectDir" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object.
Lightswitch has already been installed on the server. Have tried building the solution manually using Visual Studio on the server and it builds fine. Have also tried building the solution via the command line (using MSBuild) and it builds fine too.
Would like to ask if somebody was able to get Lightswitch building nicely on TeamCity. Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是通过命令行构建的方式(使用 TeamCity)
先决条件)
首先确保您尚未签入扩展目录,这可能会在构建时导致问题。
检查您是否已在构建计算机上安装了任何 Visual Studio 扩展。即 ExtensionsMadeEasy。您可以通过在构建机器上的 Visual Studio 中打开解决方案并尝试进行构建来测试这一点。
最后,在TeamCity中不要使用msbuild任务,使用命令行调用msbuild。
步骤 1)
步骤 2)
创建一个 bat 文件以将输出复制到正确的文件夹结构。
您现在可以将此文件夹发布到下一个环境。
最后,如果你想创建一个Web部署包,开箱即用的Visual Studio 2010不支持这一点。但是,您可以将其复制到现有网站,然后将应用程序“导出”到一个包中,然后准备通过 powershell 进行 Web 部署。
This is how you build via the Command line (using TeamCity)
Pre-requisites)
First make sure you have not checked in the extensions directory, this can cause issues when building.
Check that you have installed any visual studio extensions on the build machine .ie ExtensionsMadeEasy. You can test this by opening the solution in visual studio on the build machine and trying to do a build.
Lastly, in TeamCity do not use the msbuild task, use command line to call msbuild.
Step 1)
Step 2)
Create a bat file to copy your output to the correct folder structure.
You can now take this folder and release it to the next environment.
Finally, if you want to create a web deployment package, out the box visual studio 2010 does not support this. However, you can copy this into an existing website then "Export" your application into a package that is then ready for web deployment via powershell.
之前的答案对我们不起作用,但 Yaegor 的答案提供了一些方向。
我们遇到的问题是扩展是在用户级别安装的,而不是在系统级别安装的。这意味着 MSBuild 进程无法找到所需的扩展。
我们的解决方案是在构建服务器上使用用户帐户,登录帐户,设置 VS.NET 以便构建 LS 项目,然后切换 TeamCity 代理服务以使用新用户帐户。
这样我们就可以使用解决方案运行程序(它比 CLI 运行程序更可取,因为它提供了更好的日志记录和报告)。
The previous answers didn't work for us but Yaegor's answer provided some direction.
The issue we had was extensions are installed at the user level, not the system level. This meant the MSBuild process could not find the required extensions.
Our solution was to use a user account on the build server, log into account, setup VS.NET such that the LS project builds, and then switch the TeamCity agent service to use the new user account.
With this we were able to use the Solution runner (which is preferable to the CLI runner since it provides better logging and reporting).
对于非 Lightswitch 特定的部分:如果命令行在控制台中工作,但在 TeamCity 中失败,则很可能问题出在用户或作为服务运行。您可以尝试使用相同的环境运行 TeamCity 代理。
当命令行工作时,您可以尝试 MSBuild 和解决方案运行程序。
For not Lightswitch-specific part: If command line works from console, but fails in TeamCity, most probably the issue is in the user or running as a service. You might try running TeamCity agent with the same environment.
When command line works you can then try MSBuild and Solution runners.
当我尝试使用竹子为灯开关应用程序设置自动构建时,我遇到了同样的错误。原来是调用msbuild的版本。如果调用 64 位版本(从竹子或命令行),我会收到错误:
UnpackExtensionsToProjectDir" 任务意外失败。
切换到 32 位版本的 msbuild 可以修复该问题。32
位路径:'C:\ WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe'
64 位路径: 'C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe'
I ran into the same error when trying to set up an automated build for a lightswitch application using bamboo. Turned out to be the version of msbuild being called. If the 64bit version is called (from bamboo or the command line) I get the error:
UnpackExtensionsToProjectDir" task failed unexpectedly.
Switching to the 32bit version of msbuild fixes the problem.
32bit Path: 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe'
64bit Path: 'C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe'