Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cake Build Suppress MSBuild Warnings

I am trying to build my .net solution using cake build file. I am trying to use the documentation on the website here

My current msbuild task looks like this:

MSBuild("./solution.sln", new MSBuildSettings()
        .SetConfiguration(environmentSetting)
        .SetMSBuildPlatform(MSBuildPlatform.Automatic)
        .SetVerbosity(Verbosity.Minimal)
        .SetMaxCpuCount(System.Environment.ProcessorCount)
        .SetNodeReuse(false)
        .WithConsoleLoggerParameter("ErrorsOnly"));

It keeps throwing error for the parameter .WithConsoleLoggerParameter. I am not sure what am I doing wrong here.

The Microsoft documentation shows here the same thing and I tried running it in powershell with the same parameters and it ran just file.

like image 813
user1676508 Avatar asked Oct 12 '25 11:10

user1676508


1 Answers

Actually I figured it out. I am not sure how the argument customization works so any explanation for that would be great!

I changed the code to

MSBuild("./solution.sln", new MSBuildSettings(){
     ArgumentCustomization = args=>args.Append("/consoleloggerparameters:ErrorsOnly") 
 }
    .SetConfiguration(environmentSetting)
    .SetMSBuildPlatform(MSBuildPlatform.Automatic)
    .SetVerbosity(Verbosity.Minimal)
    .SetMaxCpuCount(System.Environment.ProcessorCount)
    .SetNodeReuse(false));

Seems to work. Hope this helps someone!

like image 75
user1676508 Avatar answered Oct 16 '25 05:10

user1676508



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!