相关疑难解决方法(0)

通过Package Manager Console从解决方案中删除项目

我试图在软件包管理器控制台中使用powershell来编写从解决方案中删除项目的脚本,我遇到了一个非常困难的时间.

我可以轻松地添加一个项目

PM> $dte.Solution.AddFromFile("C:\Dev\Project1.csproj")
Run Code Online (Sandbox Code Playgroud)

现在我想删除一个项目,但无法获得任何工作.

我尝试了很多东西,包括:

PM> $project1 = Get-Project "Project1Name"
PM> $dte.Solution.Remove($project1)>

Cannot convert argument "0", with value: "System.__ComObject", for "Remove" to
type "EnvDTE.Project": "Cannot convert the "System.__ComObject" value of type
"System.__ComObject#{866311e6-c887-4143-9833-645f5b93f6f1}" to type
"EnvDTE.Project"."
PM> $project = Get-Interface $project1 ([EnvDTE.Project])
PM> $dte.Solution.Remove($project)

Cannot convert argument "0", with value: "System.__ComObject", for "Remove" to
type "EnvDTE.Project": "Cannot convert the "System.__ComObject" value of type
"NuGetConsole.Host.PowerShell.Implementation.PSTypeWrapper" to type
"EnvDTE.Project"."
Run Code Online (Sandbox Code Playgroud)
PM> $project = [EnvDTE.Project] ($project1)

Cannot convert the "System.__ComObject" value of type
"System.__ComObject#{866311e6-c887-4143-9833-645f5b93f6f1}" …
Run Code Online (Sandbox Code Playgroud)

powershell automation visual-studio envdte nuget

7
推荐指数
2
解决办法
1281
查看次数

标签 统计

automation ×1

envdte ×1

nuget ×1

powershell ×1

visual-studio ×1