You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The actual content of the cs files doesn't seem to matter.
And now, this is how I write my batch script
set slnFile=%~dp0CSProjectMultiConstants.sln
dotnet clean "%slnFile%" --configuration Debug REM comment the dotnet clean line out will make the error disappears
dotnet build "%slnFile%" -t:BuildVer2023 -c Debug
If I run the above .bat file, then I will surely get crash as such:
E:\>dotnet clean "D:\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants.sln" --configuration Debug
Build succeeded in 0.4s
E:\>dotnet build "D:\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants.sln" -t:BuildVer2023 -c Debug
MultipleConstantTest net8.0 failed with 3 error(s) (1.2s)
CSC : error CS2012: Cannot open 'D:\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants\obj\Debug\CSProjectMultiConstants.dll' for writing -- 'The process cannot access the file 'D\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants\obj\Debug\CSProjectMultiConstants.dll' because it is being used by another process.' [D:\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants\CSProjectMultiConstants_dfx0esc2_wpftmp.csproj]
CSC : error CS2012: Cannot open 'D:\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants\obj\Debug\CSProjectMultiConstants.dll' for writing -- 'The process cannot access the file 'D:\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants\obj\Debug\CSProjectMultiConstants.dll' because it is being used by another process.' [D:\.Net Plain\CSProjectMultiConstants\CSProjectMultiConstants\CSProjectMultiConstants_dfx0esc2_wpftmp.csproj]
D:\.Net Plain\CSProjectMultiConstants\MultipleConstantTest\MultipleConstantTest.csproj(15,5): error MSB3073: The command "dotnet build -p:C3DVersion=Ver2023 -c Debug" exited with code 1.
Build failed with 3 error(s) in 1.5s
The crash can be reproduced even after I restart my machine. And consistently, every single time. Regardless of whether VS 2022 is opened at that time or not.
The text was updated successfully, but these errors were encountered:
WindingWinter
changed the title
Solution build always fail with CS2012 "Cannot open" file errors
Solution build always fail with CS2012 "Cannot open dll for writing" errors
Nov 22, 2024
Related to #9964 and #11593, but this time, it seems that I can always always reproduce it with the below solution and csprojects.
The solution file:
The
CSProjectMultiConstants.csproj
The
MultipleConstantTest.csproj
The actual content of the cs files doesn't seem to matter.
And now, this is how I write my batch script
If I run the above
.bat
file, then I will surely get crash as such:The crash can be reproduced even after I restart my machine. And consistently, every single time. Regardless of whether VS 2022 is opened at that time or not.
The text was updated successfully, but these errors were encountered: