Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Task PowerShell version 2.228.0 runs perfectly and 2.230.0 fails: Unable to find type [System.Xml.Linq.XDocument] #19257

Closed
1 of 4 tasks
luislhg opened this issue Nov 10, 2023 · 3 comments
Labels
Area: ABTT Akvelon Build Tasks Team area of work bug stale Task: PowerShell

Comments

@luislhg
Copy link

luislhg commented Nov 10, 2023

Task name

PowerShell

Task version

2.*

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows-2022

Task log

-- This is 2.230.0 output log, failing
Starting: Script: ConsoleSelfContained x64
==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.230.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Unable to find type [System.Xml.Linq.XDocument].
At D:\a\_temp\f049f606-ae70-42ac-abad-77dbaf06749d.ps1:15 char:36
+ ... System.Xml.Linq.XDocument]$xDoc = [System.Xml.Linq.XDocument]::Load($ ...
+                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Xml.Linq.XDocument:TypeName) [], ParentContainsErrorRecordExce 
   ption
    + FullyQualifiedErrorId : TypeNotFound
 
Generating script.
========================== Starting Command Output ===========================
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\f049f606-ae70-42ac-abad-77dbaf06749d.ps1'"
##[error]PowerShell exited with code '1'.
Finishing: Script: ConsoleSelfContained x64

Relevant log output

-- This is 2.228.0 output log, which works perfectly
Starting: Script: ConsoleSelfContained x64
==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.228.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\35cf2275-808b-45d5-914c-102f05da3078.ps1'"

SelfContained RuntimeIdentifiers OutputPath  
------------- ------------------ ----------  
true          win-x64            bin\Release\


Finishing: Script: ConsoleSelfContained x64

Aditional info

Hello I have an Azure Classic Pipeline that used to work and stopped working because of the PowerShell task. Neither the code or the Pipeline have been modified by me, the powershell script simply updated from 2.228 to 2.230 and now it no longer works.

I changed my script to manually add a reference to 'System.Xml.Linq' and it fixed this pipeline. But I wonder why out of no where PowerShell V2 just stopped having it and all pipelines will start to fail now?

It's running on Azure Pipelines, windows-2022.

-- Script
# Define the XML code to be added
$xmlCode = @"
<PropertyGroup>
    <SelfContained>true</SelfContained>
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
    <OutputPath>bin\Release\</OutputPath>
</PropertyGroup>
"@

# Load the .csproj file into an XDocument
$csprojPath = "$(System.DefaultWorkingDirectory)\Client\Client.csproj"
[System.Xml.Linq.XDocument]$xDoc = [System.Xml.Linq.XDocument]::Load($csprojPath)
# ... continues, error is in the line above.
Copy link

github-actions bot commented May 8, 2024

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label May 8, 2024
@luislhg
Copy link
Author

luislhg commented May 8, 2024

Any updates on this?

@github-actions github-actions bot removed the stale label May 8, 2024
Copy link

github-actions bot commented Nov 4, 2024

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Nov 4, 2024
@github-actions github-actions bot closed this as completed Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ABTT Akvelon Build Tasks Team area of work bug stale Task: PowerShell
Projects
None yet
Development

No branches or pull requests

2 participants