Skip to content

Having a Project dependency in incremental Target #8077

Answered by rainersigwald
NogginBops asked this question in Q&A
Discussion options

You must be logged in to vote

It's almost always a bad idea to exec dotnet build within a build--it can create race conditions, the logging is mostly lost, and it's just generally clunky.

Here, you can replace that target with a ProjectReference to the generator project, with some special properties to ensure that it builds "normally" instead of "how it would need to to be referenced here".

I made some modifications to your logic before starting this but this is the diff I applied:

diff --git a/ConsumesGeneratedFiles/ConsumesGeneratedFiles.csproj b/ConsumesGeneratedFiles/ConsumesGeneratedFiles.csproj
index 3ab3a7d..51f9003 100644
--- a/ConsumesGeneratedFiles/ConsumesGeneratedFiles.csproj
+++ b/ConsumesGeneratedFiles/C…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@NogginBops
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@NogginBops
Comment options

@rainersigwald
Comment options

@NogginBops
Comment options

@NogginBops
Comment options

Answer selected by GangWang01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants