powershell - 使用PowerShell创建类库并将其添加到解决方案

标签 powershell

我正在尝试自动化在每个Web项目上执行的某些任务。我想要的是可以在新解决方案上运行的PoSH脚本,该脚本将:

  • 加载脚本当前目录中包含的解决方案。
  • 为已加载的解决方案创建新项目并将其添加到解决方案中。
  • 创建一些类并将它们添加到每个项目中。

  • 到目前为止,我有一个简单的脚本(如下所示)可以找到并打开本地解决方案文件。
    $scriptpath = $MyInvocation.MyCommand.Path
    $dir = Split-Path $scriptpath
    Set-Location $dir
    
    $solution = Get-ChildItem | Where-Object{($_.Extension -eq ".sln")}
    
    if ($solution.Count -eq 0)
    {
        "Please place this script in the folder containing you solution file."
        break;
    }
    
    $dteObj = New-Object -ComObject "VisualStudio.DTE"
    $dteObj.Solution.Open($solution.FullName)
    

    现在如何创建新项目并将其添加到解决方案中?

    最佳答案

    查看Jim Christopher的http://studioshell.codeplex.com/

    关于powershell - 使用PowerShell创建类库并将其添加到解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16130919/

    相关文章:

    powershell - 查找以毫秒为单位的时间?

    powershell - 确定 Powershell 中不同时区的夏令时状态

    powershell - 使用 windows 命令行获取每个内核的 CPU 使用率

    azure - Publish-AzWebApp 抛出聚合异常,需要了解原因/如何调试

    arrays - Powershell 比较数组元素

    powershell - 强制在 powershell 脚本中立即求值(按值复制变量,而不是引用)

    powershell - 使用Powershell在Active Directory中基于说明的用户列表

    powershell - 使用Write-Error在Powershell中写入错误流

    powershell - 使用 CSV 文件通过 IP 地址从网络中提取计算机名称

    powershell - 如何在powershell的Invoke-RestMethod中转换curl命令