Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7172655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:39:34+00:00 2026-05-28T15:39:34+00:00

In my psake build script, I have a property called $build_mode that I set

  • 0

In my psake build script, I have a property called $build_mode that I set to “Release”.

I have 2 tasks; “Compile_Debug”, “Compile_Release”. In Compile_Debug, I change $build_mode to “Debug” and it works fine while that task executes; however, if I have a have another task execute that uses $build_mode afterwards, $build_mode is back to “Release”.

Is there a way to globally change or set a variable in a Psake build script so that an updated value can be used between tasks?

(I’m trying to have 1 “test” or 1 “package” task instead of a “Test_Debug”, etc.)

Code:

properties {
    $build_mode = "Release"
}

task default -depends Compile_Debug, Test

task Compile_Debug {
    $build_mode = "Debug"
    # Compilation tasks here that use the Debug value
}

task Test {
        # Test related tasks that depend on $build_mode being updated.
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:39:35+00:00Added an answer on May 28, 2026 at 3:39 pm

    Why don’t you pass the build mode as parameter to the tasks from the Invoke-Psake?

     Invoke-Psake "$PSScriptRoot\Deploy\Deploy.Tasks.ps1" `
            -framework $conventions.framework `
            -taskList $tasks `
            -parameters @{
                    "build_mode" = "Debug"
                }
    

    And in the tasks you can now use $build_mode

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple Psake build script (default.ps1) that calls Invoke-Psake from within
I have the following test defined in a psake build script: task package -depends
I have a very simple script that uses Copy-Item in the Task Build section
I have the below function as a part of my psake build. When the
Does anybody know or have a link to how I set up psake to
I have been automating all my builds through PSake and finding it really useful
Having just spent a frustrating amount of time configuring an automated build with psake
I have this code to load a config file and read all the values
I am working with PowerShell 2.0 with Psake 1.4 Here is the dos command
I have the next code to work on ASP.Net controls. I'm trying to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.