samhowes / rules_msbuild

Build .csproj files with Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UseSharedCompilation=false likely causes a slower build

samhowes opened this issue · comments

I saw the message

Using shared compilation with compiler from directory: /home/sam/.cache/bazel/_bazel_sam/c0ab60a4963be8b657cd35acdb19a608/external/dotnet_sdk/sdk/3.1.100/Roslyn/bincore

From the binlog on az ubuntu when a build failed.

This led to this SO post:
https://stackoverflow.com/questions/47590068/what-means-the-using-shared-compilation-with-compiler-from-directory-messag

Setting UseSharedCompilation to false got the build to succeed, but apparently slows down the build. As such, this issue can be closed, and a new optimization issue can be opened.

What's happening is the MSBuild property UseSharedCompilation is being set to false. As such we are not using the compiler server and you're paying the JIT cost for CSC on every build. That is the reason for the slow down.

Originally posted by @samhowes in #33 (comment)

The csc build process that gets started appears to not have permissions to write the the desired directories in the sandboxes on linux:

CSC : error CS2012: Cannot open '/home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/sandbox/linux-sandbox/62/execroot/rules_msbuild/bazel-out/k8-fastbuild/bin/tests/examples/Grpc/Protos/obj/netcoreapp3.1/Protos.Net.dll' for writing -- 'Read-only file system'

I think [persistent workers](https://docs.bazel.build/versions/main/persistent-workers.html_ is actually the intended solution for situations like this