Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

MSBuild failing



  • So far the other projects I've been building with 5.x have not had extra properties being set so they have been building fine.
    Now I've converted another project to 5 and the MSBuild action, using the new one, fails with this strange error. This project has several properties that are passed in.
    Nothing in this project has changed and none of the properties have changed, the only change is converting to BM 5.

    Here is the piece of Otter Script, note all the variables shown have the correct values:

    Code
    
    with timeout = 240
        {
            Build-Project $WorkingDirectory\Sci\Framework\Service\Sm\Scheduling\Api\SchedulingServer\Sci.Framework.Service.Sm.Scheduling.Api.SchedulingServer.csproj
            (
                Configuration: Release,
                Platform: AnyCPU,
                MSBuildProperties: DeployOnBuild=true;PublishProfile=$RelPublishProfile;VisualStudioVersion=11.0;WORKSPACE=$WorkingDirectory,
                Arguments: /m:$BUILD_PROCESSES /nologo /t:rebuild
            );
        }
    

    and here is the Error info:

    Error: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(340,29): error MSB4115: The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(IntermediateOutputPath)" evaluates to "obj\Release;Platform=AnyCPU;DeployOnBuild=true;PublishProfile=Build_Deploy_Release;VisualStudioVersion=11.0;WORKSPACE=D:\InedoAgent\BuildMaster\Temp_E2046_D1016" /m:16 /nologo /t:rebuild" which is not a scalar value.

    I tried changing all the properties to be /p: without the semicolons but that failed the exact same way. Something about the way it's combining all the info and passing to MSBuild doesn't seem to be working correctly.

    Product: BuildMaster
    Version: 5.3.6



  • This method in BuildMSBuildProjectOperation.cs should give some insight into how the arguments are processed, and then passed to msbuild.

    Note the exact command should also be logged right before it's executed, so you can see the result of the argument string. It's possible there's a bug in the way it's processing arguments, but these are very sensitive.. and you get obscure errors from MSBuild when it failus like that.



  • Alana,
    this exact same project worked under BM 4 and I take the exact properties, etc. and run it via MSBuild 4, which is what BM is using here, it all works.
    So it seems it was something changed between 4 and 5. For example the way you have us put in everything in the UI was changed so you must have changed how you process the properties and other settings.
    You can see right in the error what it's passing and the problem it says is some extra slash, yet as you can see in what I'm entering there are no slashes other than the path statement.



  • Another thing about this, if you look at the error it's having a problem setting an output path yet I never set the output path I've left it to the Projects settings for it's output path.
    The code you pointed me to is supposed to allow no output path yet somehow you're still trying to put one.
    With MSBuild you do not have to set an output path when building solutions or projects and usually the projects will have Relative paths for output which should be used as the default if an output dir is not indicated.



  • this exact same project worked under BM 4 and I take the exact properties, etc. and run it via MSBuild 4, which is what BM is using here, it all works. So it seems it was something changed between 4 and 5.

    Yes, it was fully and completely reimplemented/rewritten as an Operation from an Action, so basically everything changed. Please keep in mind, the v4/Legacy engine had "Source and Target Directories" quirks to deal with; the new execution engine does not; please refer to KB#1118: Legacy Plans in BuildMaster 5.0 for more details.

    I added in some logging for the extensions so you can see exactly what command is being executed. Can you download and install manually? WindowsSDK-5.1.4.zip

    Once you see the exact process/arguments that is being run, hopefully it will be a lot more obvious.



  • I did what you asked but it's just showing what I already have shown you which is the properties and settings I pass in.
    From what I can tell is it looks like it's the WORKSPACE property that I need to set which is assigned your WorkingDirectory variable and it appears you put a trailing slash.

    Here's the extra output from it:

    Code
    

    MSBuildToolsPath: C:\Windows\Microsoft.NET\Framework64\v4.0.30319
    Process: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
    Arguments: "/logger:D:\InedoAgent\BuildMaster\ExtensionsTemp\WindowsSDK\BmBuildLogger.dll"
    /noconsolelogger "D:\InedoAgent\BuildMaster\Temp_E2071_D1016\Sci\Framework\Service\Sm\Scheduling\Api\SchedulingServer\Sci.Framework.Service.Sm.Scheduling.Api.SchedulingServer.csproj"
    "/p:Configuration=Release;DeployOnBuild=true;PublishProfile=Build_Deploy_Release;VisualStudioVersion=11.0;WORKSPACE=D:\InedoAgent\BuildMaster\Temp_E2071_D1016"
    /t:rebuild /m:8
    Working directory: D:\InedoAgent\BuildMaster\Temp_E2071_D1016\Sci\Framework\Service\Sm\Scheduling\Api\SchedulingServer

    I'll try adding a piece of script prior to calling MSbuild here to strip out that trailing slash on WorkingDirectory.



  • Yes, that would do it; the $WorkingDirectory() function will always ends return a slash.

    So, you'll want to definitely trim it; you can do this with a $PSEval, but we will have built-ins soon - https://github.com/Inedo/inedox-inedocore/issues/9



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation