我正在尝试设置TeamCity来构建我的项目,但是我的psake buildscript失败了,其原因被缩小到无法找到git可执行文件,这应该是在路径上.当我启动PowerShell并自己执行该操作时,一切正常.
Path环境变量的内容(如"Windows环境变量"对话框中的"系统变量"列表以及注册表中所示HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment\Path)是
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Git\cmd
Run Code Online (Sandbox Code Playgroud)
但是TeamCity说它的env.Path就是
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Windows\System32\WindowsPowerShell\v1.0
Run Code Online (Sandbox Code Playgroud)
我重新启动了计算机(多次),这无济于事.
为什么TeamCity构建代理的PATH变量与系统默认变量不同,我该如何解决?
teamcity continuous-integration environment-variables psake teamcity-6
使用Powershell和Psake为可视化工作室解决方案创建包和部署.尝试使用msbuild部署数据库项目 - 使用msdos visual studio命令行正常工作
msbuild /target:Deploy /p:UseSandboxSettings=false /p:TargetConnectionString="aConnectionWithSpacesAndSemiColons" "aDatabaseProjectPathWithSpaces"
Run Code Online (Sandbox Code Playgroud)
从powershell调用时,相同的方法调用会导致错误
& msbuild /target:Deploy /p:UseSandboxSettings=false /p:TargetConnectionString="aConnectionWithSpacesAndSemiColons" "aDatabaseProjectPathWithSpaces"
Run Code Online (Sandbox Code Playgroud)
与空间有关 - 无法弄清楚如何在powershell中复制此调用 - 示例数据库连接字符串数据源=.\ SQL2008;初始目录= DocumentExecution; Integrated Security = True;
我正在研究用于ASP.NET MVC 2应用程序的构建工具.我喜欢使用脚本语言而不是XML的想法,并将我的选择范围缩小到psake或rake.我对Ruby或PowerShell没有多少经验,但我也愿意学习.如果那是我最好的选择,我不介意在我的构建服务器上安装Ruby.
我的构建没有太复杂或不寻常.它需要从Mercurial仓库中获取源代码,构建Visual Studio 10解决方案,对配置文件进行一些转换,基于Database(Data Dude)项目构建/运行SQL脚本,复制VS的Web Publish,以及做一些其他基本文件同步.
任何人都有可以比较它们的rake和psake的经验吗?一个人在功能方面是否优于另一个,还是仅仅归结为脚本语言偏好?
提前致谢.
编辑:我还没有CI解决方案,但我倾向于使用TeamCity.我以为我会提到它,以防一个构建工具比另一个更好.
注意:我在Windows Vista上使用PowerShell 2.0.
我正在尝试添加对为psake指定构建参数的支持,但我遇到了一些奇怪的PowerShell变量作用域行为,专门处理使用Export-ModuleMember导出的调用函数(这是psake公开它的主要方法的方式).以下是一个简单的PowerShell模块来说明(名为repoCase.psm1):
function Test {
param(
[Parameter(Position=0,Mandatory=0)]
[scriptblock]$properties = {}
)
$defaults = {$message = "Hello, world!"}
Write-Host "Before running defaults, message is: $message"
. $defaults
#At this point, $message is correctly set to "Hellow, world!"
Write-Host "Aftering running defaults, message is: $message"
. $properties
#At this point, I would expect $message to be set to whatever is passed in,
#which in this case is "Hello from poperties!", but it isn't.
Write-Host "Aftering running properties, message …Run Code Online (Sandbox Code Playgroud) 传统上,nunit-console.exe已经包含在存储库和构建服务器(或任何其他机器)上,这个EXE是从某个构建脚本调用的.
既然NUnit.Runners包可用,我想知道如何从psake构建脚本中使用它.它是一个解决方案级别的包,因此它不会留下任何痕迹packages.config,也不能像其他项目级别的包一样自动恢复,所以我想需要Install-Package从psake脚本调用,等待下载然后执行单元测试?希望这个下载只能运行一次,并且每次运行时都不会减慢构建速度.或者会吗?
我有一个带有几个任务的default.ps1文件,其中一些我不经常使用.
而不是打开文件和grep'ing任务,有没有办法在命令行中列出它们?理想情况下附加一些描述(将在任务附近设置).
我正在考虑类似于rake用-t做的事情(见这里例如)
您有一个包含大量项目文件的大型Visual Studio解决方案.如何验证所有项目是否遵循其属性设置中的某些规则,并在添加新项目时强制执行这些规则.例如,检查所有项目是否:
TargetFrameworkVersion = "v4.5"
Platform = "AnyCPU"
WarningLevel = 4
TreatWarningsAsErrors = true
OutputPath = $(SolutionDir)bin
SignAssembly = true
AssemblyName = $(ProjectFolderName)
Run Code Online (Sandbox Code Playgroud)
我自己知道两种方法,我将在下面的答案中添加,但我想知道人们如何进行这种类型的项目测试.我特别感兴趣的是要了解可用的解决方案,例如库或构建任务,而不必创建新的东西或从头开始编写.
我显然不知道自己在做什么.
我终于得到了这个PowerShell命令.但我无法弄清楚它为什么会起作用.
我担心的是最后的""角色:
&"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" `
-verb:sync `
-source:contentPath="$build_directory\deploy" `
-dest:contentPath="$server_temp_directory,computerName=$server,username=$server_username,password=$server_password" `
-verbose `
-postSync=runCommand="powershell -NoLogo -NoProfile -Command $server_temp_directory\remotetasks.ps1 Deploy""
Run Code Online (Sandbox Code Playgroud)
为什么我需要双重双引号?
我的IDE(PowerGUI)说线路没有正确结束,但这是我可以按需要运行命令的唯一方法.
是什么,我 - 和IDE - 不知道在PowerShell中进行qouting?
echoargs的一点输出:
如果我跑:
echoargs -postSync=runCommand="powershell -NoLogo -NoProfile -Command $server_temp_directory\remotetasks.ps1 Deploy""
Run Code Online (Sandbox Code Playgroud)
我明白了:
Arg 0 is <-postSync=runCommand=powershell -NoLogo -NoProfile -Command \remotetasks.ps1 Deploy>
Run Code Online (Sandbox Code Playgroud)
如果我在没有双引号的情况下运行,我得到:
Arg 0 is <-postSync=runCommand=powershell>
Arg 1 is <-NoLogo>
Arg 2 is <-NoProfile>
Arg 3 is <-Command>
Arg 4 is <\remotetasks.ps1>
Arg 5 is <Deploy>
Run Code Online (Sandbox Code Playgroud)
另一件需要注意的是,上面的命令只有在最后一个参数中使用=而不是:时才有效.
这不起作用:
-postSync:runCommand="powershell -NoLogo -NoProfile -Command $server_temp_directory\remotetasks.ps1 …Run Code Online (Sandbox Code Playgroud) 我似乎无法在我的psake部署脚本中正确调用此可执行文件.
如果我这样做:
exec { "$ArchiverOutputDir\NServiceBus.Host.exe /install" }
Run Code Online (Sandbox Code Playgroud)
它只是输出这个(显然没有调用可执行文件 - 只输出该表达式的值):
c:\ReloDotNet2_ServiceEndpoints\Archiver\NServiceBus.Host.exe /install
Run Code Online (Sandbox Code Playgroud)
但如果我这样做:
exec { c:\ReloDotNet2_ServiceEndpoints\Archiver\NServiceBus.Host.exe /install }
Run Code Online (Sandbox Code Playgroud)
我从可执行文件中获得了预期的输出.
如何在psake中可执行文件的路径中使用变量正确调用可执行文件?如果这实际上是PowerShell问题,请随时更正问题以反映该洞察力.
一世