4

Good morning. Please help me with msbuild.

I have many loaded csproj in array of Microsoft.Build.Evaluation.Project. I changed same properties in projects. How run parallel build of my projects?

When I run project.Build() in many threads, I received exception "The operation cannot be completed because a build is already in progress.".

I can't save projects on disk, becouse I change property, that need only for me.

1
  • you changed "some" properties, which ones? Commented Dec 3, 2012 at 13:54

1 Answer 1

1

You can call only one Build() function per process. So you need to synchronize all Build() call. Something like that:

static class ProjectBuildSync { private static readonly object _syncObject = new object(); public static bool Build(Project project) { lock (_syncObject) return project.Build(); } } ... ProjectBuildSync.Build(project); ... 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.