Getting an System.UnauthorizedAccessException in a linux build agent

vsts

(Rıfat Erdem Sahin) #1

Getting an error on my Linux vm when triggering prepare analysis on sonarcloud

System.UnauthorizedAccessException: Access to the path '/home/xxxx/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore' is denied. 
---> System.IO.IOException: Permission denied 
--- End of inner exception stack trace 
--- at System.IO.FileSystem.CreateDirectory(String fullPath) 
at System.IO.Directory.CreateDirectory(String path) 
at SonarScanner.MSBuild.Common.DirectoryWrapper.CreateDirectory(String path) 
at SonarScanner.MSBuild.PreProcessor.TargetsInstaller.CopyIfDifferent(String sourcePath, IEnumerable`1 destinationDirs) 
at SonarScanner.MSBuild.PreProcessor.TargetsInstaller.InstallLoaderTargets(String workDirectory) 
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings) 
at SonarScanner.MSBuild.BootstrapperClass.PreProcess() 
at SonarScanner.MSBuild.BootstrapperClass.Execute() 
at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger) 
at SonarScanner.MSBuild.Program.Main(String[] args)