Skip to content
Discussion options

You must be logged in to vote

@raky291 , exactly what the David put above, it is a great example; thanks for sharing that :)
I will just reinforce:

@raky291 , you can use isRunMode and/or IsPublishMode for understanding and creating conditionals for your purpose.

An example for executing it only in dev/localhost/run mode:

var postgres = builder.AddPostgres("postgres");
var postgresdb = postgres.AddDatabase("postgresdb");

IResourceBuilder migration = null;  // Initialize as null

// Conditionally set up the migration only in development mode
if (builder.ExecutionContext.IsRunMode)
{
    migration = builder.AddProject<Projects.AspireApp_Migration>("migration")
                       .WithReference(postgresdb)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by raky291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants