sonarqube-roslyn-sdk icon indicating copy to clipboard operation
sonarqube-roslyn-sdk copied to clipboard

Zip file in jar file not compatible with non-Windows OS

Open matode opened this issue 1 year ago • 0 comments

When I create a plugin for custom C# analyzers, the static folder within the jar file contains a zip file with all dlls.

However the zip file is not OS independent and contains backslashes. This causes problem, when the plugin is downloaded on build agents running e.g. on Linux.

It can be easily solved by enhancing one line in https://github.com/SonarSource/sonarqube-roslyn-sdk/blob/master/RoslynPluginGenerator/ZipExtensions.cs

Old archive.CreateEntryFromFile(file, file.Substring(pathPrefixLength).Replace('\\', '/'), CompressionLevel.Optimal);

Fix proposal archive.CreateEntryFromFile(file.Replace('\\', '/'), file.Substring(pathPrefixLength).Replace('\\', '/'), CompressionLevel.Optimal);

matode avatar Apr 02 '25 13:04 matode