gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 00:19:43 24 4
gpt4 key购买 nike

我正在尝试自动化在每个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/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com