Solution building succesfully in Visual Studio 2008 fails to build in MSBuild command line

Unanswered Solution building succesfully in Visual Studio 2008 fails to build in MSBuild command line

  • Monday, February 13, 2012 3:48 AM
     
     

    I am trying to build a solution with MSBuild.exe using a NAnt script.

    One of the projects in the solution is for Reports creation using ReportViewer (RDLC reports) This project uses a custom DLL created to set the project wide values. While building from Visual Studio we get build error for this dll reference. Once the DLL is copied to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies build error is resolved.

    However, while building through the script using MSBuild.exe, it fails with error

         [exec]   Reports\MyFile.rdlc : error rsErrorLoadingCodeModule: Error while loading code module: `ABC.CustomStyles, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Details: Could not load file or assembly 'ABC.CustomStyles, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
         [exec]   Reports\MyFile.rdlc : error rsCompilerErrorInExpression: The Color expression for the textbox `textbox4' contains an error: [BC30451] Name 'ABC' is not declared.

    This problem looks similar to the below question. However, I didn't find the suitable answer for this. Is there any workarounds or solution? (Build of this project seperately works, but not the solution which includes this project) 

    http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/b728a156-9dd1-4488-bcab-43c8841f126c?prof=required

All Replies

  • Tuesday, February 14, 2012 6:30 AM
    Moderator
     
     

    Hi VinayakBhat,
    Why do you use a NANT script in the MSBuild.exe, If you want to use the MSBuild.exe to build your solution, I suggest you to use the solution file(.sln).

    The information you provided is not enough for us to solve this issue, so please provide more information about this issue , like provide your build log file, provide the reproduce steps.

    In addition, there are many possibilities that command line build fails but IDE build successfully.
    You can refer to the following threads, see whether can fix this issue.
    commandline build fails, ide does not:
    http://social.msdn.microsoft.com/Forums/eu/msbuild/thread/9dfeb032-7f36-4fe2-b33c-57cf0afd103c
    Building setup project in devenv.com command line fails, works in IDE:
    http://connect.microsoft.com/VisualStudio/feedback/details/552799/building-setup-project-in-devenv-com-command-line-fails-works-in-ide

    Best regards,
    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us


  • Tuesday, February 21, 2012 8:13 PM
     
     

    Thanks for the response.

    I am calling MSBuild.exe from the NAnt script and passing the solution file.

    Now I am trying to build the only the poject (not the complete solution) directly using command prompt. From the logs, I can see the same error given in the above which is

    Reports\MyReport.rdlc : error rsErrorLoadingCodeModule: Error while loading code module: `ABC.CustomStyles, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Details: Could not load file or assembly ABC.CustomStyles, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    Reports\MyReport.rdlc : error rsCompilerErrorInExpression: The Color expression for the textbox `BusinessName' contains an error: [BC30451] Name 'ABC' is not declared.

    basically, I have created a custom dll ABC.CustomStyles and referenced that in the project Reports. Here is the extract from the .csproj

      <ItemGroup>
        <Reference Include="Microsoft.ReportViewer.WinForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
          <SpecificVersion>False</SpecificVersion>
          <HintPath>..\External_Libraries\Microsoft.ReportViewer.WinForms.dll</HintPath>
          <Private>True</Private>
        </Reference>
        <Reference Include="NM.CustomStyles, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
          <SpecificVersion>False</SpecificVersion>
          <HintPath>..\External_Libraries\ABC.CustomStyles.dll</HintPath>
        </Reference>

    Please suggest the solution.