-
Notifications
You must be signed in to change notification settings - Fork 234
Description
Description
When building in DEBUG Mode, I (consistently) get the following error:
error CS2012: Cannot open 'C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\obj\Debug\netstandard2.0\Internal.SonarAnalyzer.SourceGenerators.dll' for writing -- The process cannot access the file 'C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\obj\Debug\netstandard2.0\Internal.SonarAnalyzer.SourceGenerators.dll' because it is being used by another process. [C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\SonarAnalyzer.SourceGenerators.csproj]
When I build in RELEASE mode, this file lock does not appear. Note, that the behavior is similar for building from the command line and within Visual Studio. I assume the same applies to Visual Studio Code too, but I did not test that.
Reproducer
dotnet build -c=DEBUG
Results in:
Determining projects to restore...
C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\SonarAnalyzer.SourceGenerators.csproj : warning NU1601: Dependency specified was Microsoft.CodeAnalysis.Analyzers (>= 4.7.0) but ended up with Microsoft.CodeAnalysis.Analyzers 4.14.0. [C:\code\sonar-dotnet\analyzers\SonarAnalyzer.sln]
C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.Core\SonarAnalyzer.Core.csproj : warning NU1903: Package 'Google.Protobuf' 3.6.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-77rm-9x9h-xj3g [C:\code\sonar-dotnet\analyzers\SonarAnalyzer.sln]
C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.VisualBasic.Core\SonarAnalyzer.VisualBasic.Core.csproj : warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. [C:\code\sonar-dotnet\analyzers\SonarAnalyzer.sln]
C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.CSharp\SonarAnalyzer.CSharp.csproj : warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. [C:\code\sonar-dotnet\analyzers\SonarAnalyzer.sln]
C:\code\sonar-dotnet\analyzers\src\RuleDescriptorGenerator\RuleDescriptorGenerator.csproj : warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net8.0'. This package may not be fully compatible with your project. [C:\code\sonar-dotnet\analyzers\SonarAnalyzer.sln]
C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.VisualBasic\SonarAnalyzer.VisualBasic.csproj : warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. [C:\code\sonar-dotnet\analyzers\SonarAnalyzer.sln]
All projects are up-to-date for restore.
...
CSC : error CS2012: Cannot open 'C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\obj\Debug\netstandard2.0\Internal.SonarAnalyzer.SourceGenerators.dll' for writing -- The process cannot access the file 'C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\obj\Debug\netstandard2.0\Internal.SonarAnalyzer.SourceGenerators.dll' because it is being used by another process. [C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\SonarAnalyzer.SourceGenerators.csproj]
SonarAnalyzer.ShimLayer.CodeGeneration -> C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.ShimLayer.CodeGeneration\bin\Debug\netstandard2.0\Internal.SonarAnalyzer.ShimLayer.CodeGeneration.dll
...
CSC : error CS2012: Cannot open 'C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\obj\Debug\netstandard2.0\Internal.SonarAnalyzer.SourceGenerators.dll' for writing -- The process cannot access the file 'C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\obj\Debug\netstandard2.0\Internal.SonarAnalyzer.SourceGenerators.dll' because it is being used by another process. [C:\code\sonar-dotnet\analyzers\src\SonarAnalyzer.SourceGenerators\SonarAnalyzer.SourceGenerators.csproj]
190 Warning(s)
1 Error(s)
Time Elapsed 00:00:09.35
Product and Version
Commit Hash: 0b180f6