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

  • Home
  • SEARCH
  • 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 6946369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:33:23+00:00 2026-05-27T13:33:23+00:00

When i am using batch file for invoking msbuild.exe ,logging functionality works fine. But

  • 0

When i am using batch file for invoking msbuild.exe ,logging functionality works fine.

But when it is written in powershell ,it doesn’t log anything.

Following is the powershell script i am using . Any idea how to solve this?

# Script to invoke build
. ./vsvars32.ps1

Remove-Item "ViewBuild1.log"

$MsbuildBinPath="C:\Windows\Microsoft.NET\Framework\v4.0.30319"


$errorLogFileName="ViewBuild1Errors.log"
$buildLogFileName="ViewBuild1.log"

$MSBuildLogger="/flp1:Append;LogFile=ViewBuild1.log;Verbosity=Normal; /flp2:LogFile=ViewBuild1Errors.log;Verbosity=Normal;errorsonly"

$MSBuildFile="Build.Targets"

Write-Host --------------------------------------------
Write-Host Prepare for the build
Write-Host --------------------------------------------
&"$MsbuildBinPath\Msbuild.exe" $MSBuildFile "/t:Prepare"  "$MSBuildLogger"
if ($LastExitCode -ne 0) {
Write-Host "It failed, send a mail"
} 
#$LastExitCode

&"$MsbuildBinPath\Msbuild.exe" $MSBuildFile "/t:BuildAll"  "$MSBuildLogger"

Viewbuild1.log has no contents at all after executing though i have used append option in filelogger.

  • 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-27T13:33:24+00:00Added an answer on May 27, 2026 at 1:33 pm

    All of $MSBuildLogger is passed as a single argument to MSBuild e.g.:

    PS> $MSBuildLogger="/flp1:Append;LogFile=ViewBuild1.log;Verbosity=Normal; /flp2:LogFile=ViewBuild1Errors.log;Verbosity=
    Normal;errorsonly"
    PS> echoargs $MSBuildLogger
    Arg 0 is </flp1:Append;LogFile=ViewBuild1.log;Verbosity=Normal; /flp2:LogFile=ViewBuild1Errors.log;Verbosity=Normal;erro
    rsonly>
    

    Try using two variables instead:

    PS> $MSBuildLogger1="/flp1:Append;LogFile=ViewBuild1.log;Verbosity=Normal;"
    PS> $MSBuildLogger2="/flp2:LogFile=ViewBuild1Errors.log;Verbosity=Normal;errorsonly"
    PS> echoargs $MSBuildLogger1 $MSBuildLogger2
    Arg 0 is </flp1:Append;LogFile=ViewBuild1.log;Verbosity=Normal;>
    Arg 1 is </flp2:LogFile=ViewBuild1Errors.log;Verbosity=Normal;errorsonly>
    

    FYI, echoargs.exe is a utility from the PowerShell Community Extensions.

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

Sidebar

Related Questions

I want to compile a batch file into an EXE file using C++. I
By any chance on Windows 7 using a batch file via DOS and/or Powershell
I like to run two programs using batch file, but the condition is, the
i am trying to delete some files using a batch file.. (winxp) my problem
I am trying to map a drive using a batch file. I have tried:
I package our server releases into zip files using a batch file (Windows), running
I am writing a batch file script using Windows command and want to change
I have a batch file containing a python script using the Output template> %(NAME)s
i am using vbscript to call a batch file. my script looks like: dim
I'm running a batch file command on a server which is using reg query

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.