none
MSBuild error MSB3073 - when running from C:\ drive, but successful on I:\ drive RRS feed

  • Question

  • Hello,

    Preface: I've been trying to diagnose a problem when installing our product on a customer's environment. Our installer uses internally msbuild for some of the steps. The issue on the customer environment was that one of msbuild targets failed when trying the installation on I:\ drive, but succeeded if installing in the default location (C:\Program Files (x86)\...). Seemingly the issue was that the command being executed was truncated (the entire command was a little over 11000 symbols long). So I created a simple script to try and isolate the problem.

    So I have the following bat script:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe .\TestSimplePath.xml > .\logSimplePath.txt

    The TestSimplePath.xml looks like this (simplified, I removed most of the content in <LongParameter> so that it is easier to read, but the idea was to have the command longer than 11000 symbols, so the content itself didn't matter):

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
      <PropertyGroup>
        <WorkDir>$(MSBuildProjectDirectory)</WorkDir>
    
        <LongParameter>&quot;$(WorkDir)\AAAAA0 $(WorkDir)\AAAAA1 ... $(WorkDir)\AAAECF&quot;</LongParameter>
    
      </PropertyGroup>
    
      <Target Name="Test">
        <Exec WorkingDirectory="$(MSBuildProjectDirectory)"
              Command="&quot;$(WorkDir)\Test.exe&quot; $(LongParameter)"/>
      </Target>
    </Project>

    What Test.exe does is simply print in the console the parameters that it received. Tested it on my machine - as expected everything works and logSimplePath.txt contains the passed parameters. Then I asked the customer to run it - once deploying and running it from "C:\Program Files (x86)\Program\Test" and once from "I:\Program\Test". When running it from I:\ drive the command succeded, however when running it from C:\ - it failed. Here is the error (the customer machine is in Japanese, the output is shortened (...) for easier readability):

    Microsoft (R) Build Engine バージョン 4.0.30319.34209
    [Microsoft .NET Framework、バージョン 4.0.30319.34209]
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    2016/03/09 14:19:28 にビルドを開始しました。
    ノード 1 上のプロジェクト "C:\Program Files (x86)\Program\Test\TestSimplePath.xml" (既定のターゲット)。
    Test:
      "C:\Program Files (x86)\Program\Test\Test.exe" "C:\Program Files (x86)\Program\Test\AAAAA0 C:\Program Files (x86)\Program\Test\AAAAA1 ... (x86)\Program\Test\AAAECF"
      指定されたプログラムは実行できません。
    C:\Program Files (x86)\Program\Test\TestSimplePath.xml(12,5): error MSB3073: コマンド ""C:\Program Files (x86)\Program\Test\Test.exe" "C:\Program Files (x86)\Program\Test\AAAAA0 C:\Program Files (x86)\Program\Test\AAAAA1 ... (x86)\Program\Test\AAAECF"" はコード 9020 で終了しました。
    プロジェクト "C:\Program Files (x86)\Program\Test\TestSimplePath.xml" (既定のターゲット) のビルドが終了しました -- 失敗。
    
    ビルドに失敗しました。
    
    "C:\Program Files (x86)\Program\Test\TestSimplePath.xml" (既定のターゲット) (1) ->
    (Test ターゲット) -> 
      C:\Program Files (x86)\Program\Test\TestSimplePath.xml(12,5): error MSB3073: コマンド ""C:\Program Files (x86)\Program\Test\Test.exe" "C:\Program Files (x86)\Program\Test\AAAAA0 C:\Program Files (x86)\Program\Test\AAAAA1 ... C:\Program Files (x86)\Program\Test\AAAECF"" はコード 9020 で終了しました。
    
        0 個の警告
        1 エラー
    
    経過時間 00:00:00.10

    So my question is what might be causing this? The command successfully runs on one drive, but fails on another. 

    Friday, March 11, 2016 4:41 PM

Answers

  • Hi dimitar.barfonchovski,

    >> Tested it on my machine - as expected everything works and logSimplePath.txt contains the passed parameters.  Then I asked the customer to run it - …. When running it from I:\ drive the command succeded, however when running it from C:\ - it failed.

    Do you have the administrator permissions on your client machine when you test? According to your issue description, I guess this issue may be related to the folder access permissions, you could try to let the customer run the script with administrator privileges to solve this issues.

    Besides, if it’s not easy to change the customer machine environment, you could build a test environment which is the same with customer’s and then refer to the following blog to debug the script in VS to find out the issue point.
    https://blogs.msdn.microsoft.com/visualstudio/2010/07/06/debugging-msbuild-script-with-visual-studio/

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 15, 2016 1:39 AM

All replies

  • Hi dimitar.barfonchovski,

    >> Tested it on my machine - as expected everything works and logSimplePath.txt contains the passed parameters.  Then I asked the customer to run it - …. When running it from I:\ drive the command succeded, however when running it from C:\ - it failed.

    Do you have the administrator permissions on your client machine when you test? According to your issue description, I guess this issue may be related to the folder access permissions, you could try to let the customer run the script with administrator privileges to solve this issues.

    Besides, if it’s not easy to change the customer machine environment, you could build a test environment which is the same with customer’s and then refer to the following blog to debug the script in VS to find out the issue point.
    https://blogs.msdn.microsoft.com/visualstudio/2010/07/06/debugging-msbuild-script-with-visual-studio/

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 15, 2016 1:39 AM
  • Thanks for the suggestion, Li. I'll check if this is related to folder access permissions.
    Thursday, March 17, 2016 5:33 PM