0

I have a project that depends on many other projects. I made a change in the source code of that project. If I run msbuild on that project, it would go through all of its dependency projects. It would not reach to the actual compilation, because they did not change, but it would still take it quite some time to figure out that nothing needs to be done there.

I am looking for a way to check that the code just in the given project compiles without spending any extra cycles on other projects. I know Roslyn can do it - Edit and Continue does it during debugging.

How can I do it myself? Either with msbuild (if there is a hidden way to do it) or with Roslyn API.

mark
  • 59,016
  • 79
  • 296
  • 580
  • Does [this](https://stackoverflow.com/questions/5137277/build-msbuild-target-without-dependencies) answer your question? Add `/p:BuildProjectReferences=false` to build command – JL0PD Jun 24 '21 at 02:22
  • @JL0PD - You are correct. Please, arrange as an answer so I could credit you. – mark Jun 25 '21 at 03:04

1 Answers1

1

You can use BuildProjectReferences property to avoid building referenced projects

dotnet build --project path_to_project.csproj /p:BuildProjectReferences=false

Or if you want to always avoid building referenced projects add this property to project file

<PropertyGroup>
    <BuildProjectReferences>false</BuildProjectReferences>
</PropertyGroup>
JL0PD
  • 3,698
  • 2
  • 15
  • 23