microsoft / tfs-cli

Cross-platform CLI for Microsoft Team Foundation Server and Visual Studio Team Services
MIT License
369 stars 132 forks source link

Content of [Content_Types].xml varies depending on build platform -> missing resource on VSTS #257

Open henryju opened 6 years ago

henryju commented 6 years ago

(Might be related to #177, but I will try to give more details.)

tfx-cli 0.5.5

In our VSTS extension, we are embedding a command line tool that will be run by the task. Our command line tool has different executables according to the operation system: bin/sonar-scanner.bat on Windows, bin/sonar-scanner (shell script) on Linux/MacOSX.

We discovered that our extension is broken when packaged from a Windows computer. The issue is that shell scripts are missing on the agent.

Logs on VSTS when extension is packaged from Linux:

2018-02-27T09:11:43.3871439Z ##[debug]findPath: 'D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild'
2018-02-27T09:11:43.3872069Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2018-02-27T09:11:43.3872661Z ##[debug]findOptions.followSymbolicLinks: 'true'
2018-02-27T09:11:43.3873276Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild (directory)
2018-02-27T09:11:43.3874640Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Microsoft.VisualStudio.Setup.Configuration.Interop.dll (file)
2018-02-27T09:11:43.3877600Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Internal.PostProcess.dll (file)
2018-02-27T09:11:43.3879043Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Internal.PreProcess.dll (file)
2018-02-27T09:11:43.3880320Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.dll (file)
2018-02-27T09:11:43.3881646Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.exe (file)
2018-02-27T09:11:43.3882757Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.pdb (file)
2018-02-27T09:11:43.3883662Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.runtimeconfig.json (file)
2018-02-27T09:11:43.3884529Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Newtonsoft.Json.dll (file)
2018-02-27T09:11:43.3885359Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778 (directory)
2018-02-27T09:11:43.3886285Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin (directory)
2018-02-27T09:11:43.3887138Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-runner (file)
2018-02-27T09:11:43.3888096Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-runner.bat (file)
2018-02-27T09:11:43.3888956Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-scanner (file)
2018-02-27T09:11:43.3889897Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-scanner-debug (file)
2018-02-27T09:11:43.3890674Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-scanner-debug.bat (file)
2018-02-27T09:11:43.3891447Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-scanner.bat (file)
2018-02-27T09:11:43.3894708Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\conf (directory)
2018-02-27T09:11:43.3896159Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\conf\sonar-scanner.properties (file)
2018-02-27T09:11:43.3897210Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\lib (directory)
2018-02-27T09:11:43.3898066Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\lib\sonar-scanner-cli-3.0.3.778.jar (file)
2018-02-27T09:11:43.3898923Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Analysis.xml (file)
2018-02-27T09:11:43.3899942Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Common.dll (file)
2018-02-27T09:11:43.3901880Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Integration.Tasks.dll (file)
2018-02-27T09:11:43.3903423Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.dll (file)
2018-02-27T09:11:43.3904282Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.exe (file)
2018-02-27T09:11:43.3905288Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.pdb (file)
2018-02-27T09:11:43.3906414Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.runtimeconfig.json (file)
2018-02-27T09:11:43.3907365Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarScanner.Shim.dll (file)
2018-02-27T09:11:43.3908642Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\System.Runtime.Serialization.Formatters.dll (file)
2018-02-27T09:11:43.3909535Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Targets (directory)
2018-02-27T09:11:43.3910330Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Targets\SonarQube.Integration.ImportBefore.targets (file)
2018-02-27T09:11:43.3911163Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Targets\SonarQube.Integration.targets (file)
2018-02-27T09:11:43.3911981Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\TeamBuild.SonarQube.Integration.Classic.dll (file)
2018-02-27T09:11:43.3913350Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\TeamBuild.SonarQube.Integration.dll (file)
2018-02-27T09:11:43.3914066Z ##[debug]35 results
2018-02-27T09:11:43.3914635Z ##[debug]found 35 paths

Logs when extension is packaged from Windows:

2018-02-26T12:00:33.5989963Z ##[debug]findPath: 'D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild'
2018-02-26T12:00:33.5990389Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2018-02-26T12:00:33.5991195Z ##[debug]findOptions.followSymbolicLinks: 'true'
2018-02-26T12:00:33.5991781Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild (directory)
2018-02-26T12:00:33.6000144Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Microsoft.VisualStudio.Setup.Configuration.Interop.dll (file)
2018-02-26T12:00:33.6001244Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Internal.PostProcess.dll (file)
2018-02-26T12:00:33.6002077Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Internal.PreProcess.dll (file)
2018-02-26T12:00:33.6002640Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.dll (file)
2018-02-26T12:00:33.6003169Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.exe (file)
2018-02-26T12:00:33.6003740Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.pdb (file)
2018-02-26T12:00:33.6004307Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\MSBuild.SonarQube.Runner.runtimeconfig.json (file)
2018-02-26T12:00:33.6004836Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Newtonsoft.Json.dll (file)
2018-02-26T12:00:33.6005545Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778 (directory)
2018-02-26T12:00:33.6014969Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin (directory)
2018-02-26T12:00:33.6018230Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-runner.bat (file)
2018-02-26T12:00:33.6018949Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-scanner-debug.bat (file)
2018-02-26T12:00:33.6019783Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\bin\sonar-scanner.bat (file)
2018-02-26T12:00:33.6020297Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\conf (directory)
2018-02-26T12:00:33.6026724Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\conf\sonar-scanner.properties (file)
2018-02-26T12:00:33.6027231Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\lib (directory)
2018-02-26T12:00:33.6031564Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\sonar-scanner-3.0.3.778\lib\sonar-scanner-cli-3.0.3.778.jar (file)
2018-02-26T12:00:33.6032184Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Analysis.xml (file)
2018-02-26T12:00:33.6032695Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Common.dll (file)
2018-02-26T12:00:33.6033304Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Integration.Tasks.dll (file)
2018-02-26T12:00:33.6033858Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.dll (file)
2018-02-26T12:00:33.6034633Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.exe (file)
2018-02-26T12:00:33.6035107Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.pdb (file)
2018-02-26T12:00:33.6036047Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarQube.Scanner.MSBuild.runtimeconfig.json (file)
2018-02-26T12:00:33.6037853Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\SonarScanner.Shim.dll (file)
2018-02-26T12:00:33.6038549Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\System.Runtime.Serialization.Formatters.dll (file)
2018-02-26T12:00:33.6039041Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Targets (directory)
2018-02-26T12:00:33.6043112Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Targets\SonarQube.Integration.ImportBefore.targets (file)
2018-02-26T12:00:33.6043618Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\Targets\SonarQube.Integration.targets (file)
2018-02-26T12:00:33.6044143Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\TeamBuild.SonarQube.Integration.Classic.dll (file)
2018-02-26T12:00:33.6045082Z ##[debug]  D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.0.0\sonar-scanner-msbuild\TeamBuild.SonarQube.Integration.dll (file)
2018-02-26T12:00:33.6045646Z ##[debug]32 results
2018-02-26T12:00:33.6045978Z ##[debug]found 32 paths

That's how we discovered that the 3 shell scripts without extensions (sonar-runner, sonar-scanner and sonar-scanner-debug) are missing on the agent when the extension is originally packaged on Windows.

I was first suspecting a bug in our packaging process so I looked at the vsix content to see if the files were actually inside: but the files are effectively present even when the extension is packaged on Windows.

Then I used a tool to compute the diff of the two vsix, to finally discover that the issue seems to come from [Content_Types].xml. The content is totally different depending on the build platform.

On Windows:

<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
  <Default Extension=".js" ContentType="application/javascript"/>
  <Default Extension=".png" ContentType="image/png"/>
  <Default Extension=".map" ContentType="application/json"/>
  <Default Extension=".ts" ContentType="text/plain"/>
  <Default Extension=".md" ContentType="text/markdown"/>
  <Default Extension=".json" ContentType="application/json"/>
  <Default Extension=".bat" ContentType="application/bat"/>
  <Default Extension=".ps1" ContentType="text/ps1"/>
  <Default Extension=".srl" ContentType="application/octet-stream"/>
  <Default Extension=".cnf" ContentType="application/octet-stream"/>
  <Default Extension=".pem" ContentType="application/octet-stream"/>
  <Default Extension=".1" ContentType="application/octet-stream"/>
  <Default Extension=".bnf" ContentType="application/octet-stream"/>
  <Default Extension=".opts" ContentType="application/octet-stream"/>
  <Default Extension=".bak" ContentType="application/octet-stream"/>
  <Default Extension=".targ" ContentType="application/octet-stream"/>
  <Default Extension=".conf" ContentType="application/octet-stream"/>
  <Default Extension=".in" ContentType="application/octet-stream"/>
  <Default Extension=".patch" ContentType="application/octet-stream"/>
  <Default Extension=".jst" ContentType="application/octet-stream"/>
  <Default Extension=".exe" ContentType="application/x-msdownload"/>
  <Default Extension=".dll" ContentType="application/x-msdownload"/>
  <Default Extension=".psm1" ContentType="application/octet-stream"/>
  <Default Extension=".jar" ContentType="application/octet-stream"/>
  <Default Extension=".properties" ContentType="application/octet-stream"/>
  <Default Extension=".resjson" ContentType="text/plain"/>
  <Default Extension=".coffee" ContentType="application/octet-stream"/>
  <Default Extension=".xml" ContentType="text/xml"/>
  <Default Extension=".html" ContentType="text/html"/>
  <Default Extension=".txt" ContentType="text/plain"/>
  <Default Extension=".markdown" ContentType="application/octet-stream"/>
  <Default Extension=".def" ContentType="text/plain"/>
  <Default Extension=".targets" ContentType="application/octet-stream"/>
  <Default Extension=".vsixmanifest" ContentType="text/xml"/>
  <Default Extension=".vsomanifest" ContentType="application/json"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/ajv/LICENSE"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/asn1/LICENSE"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/assert-plus/AUTHORS"/>
[...] // Many other LICENSE files
</Types>

On Linux:

<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
  <Default Extension=".js" ContentType="application/javascript"/>
  <Default Extension=".png" ContentType="image/png"/>
  <Default Extension=".md" ContentType="text/markdown"/>
  <Default Extension=".map" ContentType="application/json"/>
  <Default Extension=".ts" ContentType="text/plain"/>
  <Default Extension=".json" ContentType="application/json"/>
  <Default Extension=".bat" ContentType="application/bat"/>
  <Default Extension=".ps1" ContentType="text/ps1"/>
  <Default Extension=".opts" ContentType="text/plain"/>
  <Default Extension=".xml" ContentType="text/xml"/>
  <Default Extension=".html" ContentType="text/html"/>
  <Default Extension=".bak" ContentType="text/plain"/>
  <Default Extension=".conf" ContentType="text/plain"/>
  <Default Extension=".targ" ContentType="text/plain"/>
  <Default Extension=".in" ContentType="text/x-shellscript"/>
  <Default Extension=".txt" ContentType="text/plain"/>
  <Default Extension=".patch" ContentType="text/x-diff"/>
  <Default Extension=".markdown" ContentType="text/plain"/>
  <Default Extension=".jst" ContentType="text/plain"/>
  <Default Extension=".def" ContentType="text/plain"/>
  <Default Extension=".psm1" ContentType="text/plain"/>
  <Default Extension=".jar" ContentType="application/java-archive"/>
  <Default Extension=".properties" ContentType="text/plain"/>
  <Default Extension=".resjson" ContentType="text/plain"/>
  <Default Extension=".cnf" ContentType="text/plain"/>
  <Default Extension=".pem" ContentType="text/plain"/>
  <Default Extension=".srl" ContentType="text/plain"/>
  <Default Extension=".1" ContentType="text/troff"/>
  <Default Extension=".bnf" ContentType="text/plain"/>
  <Default Extension=".coffee" ContentType="text/plain"/>
  <Default Extension=".dll" ContentType="application/x-dosexec"/>
  <Default Extension=".targets" ContentType="text/xml"/>
  <Default Extension=".exe" ContentType="application/x-dosexec"/>
  <Default Extension=".vsixmanifest" ContentType="text/xml"/>
  <Default Extension=".vsomanifest" ContentType="application/json"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/ajv/LICENSE"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/ajv/scripts/info"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/ajv/scripts/prepare-tests"/>
  <Override ContentType="text/x-shellscript" PartName="/tasks/analyze/new/node_modules/ajv/scripts/travis-gh-pages"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/asn1/LICENSE"/>
  <Override ContentType="text/plain" PartName="/tasks/analyze/new/node_modules/assert-plus/AUTHORS"/>
  [...] // Many other files
  <Override ContentType="text/x-shellscript" PartName="/tasks/prepare/new/sonar-scanner-msbuild/sonar-scanner-3.0.3.778/bin/sonar-runner"/>
  <Override ContentType="text/x-shellscript" PartName="/tasks/prepare/new/sonar-scanner-msbuild/sonar-scanner-3.0.3.778/bin/sonar-scanner"/>
  <Override ContentType="text/x-shellscript" PartName="/tasks/prepare/new/sonar-scanner-msbuild/sonar-scanner-3.0.3.778/bin/sonar-scanner-debug"/>
  [...] // Many other files
</Types>

As you can see, on Windows we don't have any entry for the 3 shell scripts. Do you confirm this is the reason why files are not available on the build agent? If yes, since the content of [Content_Types].xml have a strong impact on the runtime of the extension, I find it really dangerous that its content depends so heavily on the build platform.

Can't you find a way to generate it in a more consistent way? Is it possible to configure tfx-cli in order to force some entries, so that at short term we can fix the build on Windows?

T-Hugs commented 6 years ago

You can specify the content type of any asset in your manifest. e.g.

"files": [
    {
        "path": "yourScript.bat",
        "addressable": true,
        "contentType": "application/bat"
    }, { etc }
 ],

Unfortunately there's no good consistent way to generate these cross platform without hardcoding all the extensions. We have a few hard-coded, but perhaps the list could be longer.

bryanmacfarlane commented 6 years ago

@trevorsg - The build task needs to carry all files for all platforms (we have one task stored that all platform agents download). there should be nothing dynamic here.

T-Hugs commented 6 years ago

@bryanmacfarlane What do you suggest? Only thing I can think of is make the hard-coded list longer, but at some point people are going to upload files with extensions that aren't on the list. Do we generate an error if the mime type is not specified and not on our list? That's a breaking change, and could be problematic for extensions with lots of files.

nschonni commented 6 years ago

It's pretty long, but I believe that this is the "official" list https://www.iana.org/assignments/media-types/media-types.xhtml

Also seems to have NPM package https://www.npmjs.com/package/mime to query that info

henryju commented 6 years ago

The offending file(s) are shell scripts without extension so adding more hardcoded mime types will not help. Also, the file is not addressable. We only need to have it unzipped on the agent so that our task can call it.. I can understand why addressable files need to have a content type, but I don't understand why you have this constraint when extracting the task resources on the agent. Still I will try to force the content type (by chance we only have a few files), thanks for the trick. May I suggest to document the ability to override the content type, for example here: https://docs.microsoft.com/en-us/vsts/extend/develop/manifest

evertonmc commented 5 years ago

You can specify the content type of any asset in your manifest. e.g.

"files": [
    {
        "path": "yourScript.bat",
        "addressable": true,
        "contentType": "application/bat"
    }, { etc }
 ],

Unfortunately there's no good consistent way to generate these cross platform without hardcoding all the extensions. We have a few hard-coded, but perhaps the list could be longer.

Hello there. I'm having this problem with the hub.html file not being recognized as text/html and defaulting to application/octet-stream which forces the browser to download it. Since the hub file is not addressed in the files array of the manifest but in the contributions.properties.uri object, I see no possible way to override the ContentType here. Any thoughts?

PS: this only happens if I build it in an agent. Packaging locally sets the correct contentType to the html file

evertonmc commented 5 years ago

323

T-Hugs commented 5 years ago

@evertonmc Unless I'm mistaken, the file won't be included in the VSIX at all if it is only referenced in contributions.properties.uri. It is true that some files are auto-added to the package, but even in that case, the entry given in the files array should override the one that is auto-added. Therefore if you include an entry in the files array and give a contentType, it should pick that up.

evertonmc commented 5 years ago

@T-Hugs that's true, but since I'm not referencing a file but a folder in the files array, how should I give that entry a contentType?

T-Hugs commented 5 years ago

@evertonmc Got it. As a workaround, you should be able to list that individual file and give it a content type. It should play nicely with the directory entry.

mickael-caro-sonarsource commented 5 years ago

Hi,

In our latest tests, we saw that the files are not yet on the ContentType.xml file (version 0.7.8 of tfx-cli), but that the problem seems gone as the files seems correctly unzipped.

Could you confirm that something has been done on your side on this topic ?

Thanks.

VAllens commented 4 years ago

I noticed that it use winreg to try to get the Content Type value from the windows registry, fill the value of the ContentType property of the Default element.

This is the problem and solution I have encountered:

https://www.cnblogs.com/VAllen/p/azure-devops-extensions-content-types-warning-fix.html

FYI. :)