VSTO Excel Document Level Customization fail to build using “msbuild” command

DerishanV 1 Reputation point
2021-03-21T03:58:23.127+00:00

I am working with the msbuild script to build csproj files. Before building each project I increase the assembly version of each project. After increasing the version I run the build using msbuild command. The Non-VSTO projects build without any issues. I face a problem when building VSTO Excel Document Level Customization project. The build fails with the following error

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: The "FindRibbons" task failed unexpectedly. [D:\src\VstoAddin\VstoAddin\VstoAddin.csproj] C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'VstoAddin, Version=21.1.1.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d' or one of its dependencies. The system cannot find the file specified.

I am using Visual Studio Professional 2017 15.9.26. I searched a lot regarding this error, but I could not figure out a solution. Experts in this area please give some suggestion.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,307 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,532 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,251 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pranam K 6 Reputation points
    2021-03-29T15:28:17.843+00:00

    First thing : Try running as "Administrator"

    1) Please Change your application pool setting.
    Keep the steps:

    IIS manager open
    Click 'Application pools' (Application pools list)
    Select your application pool
    Right click your application pool and select 'Advanced settings '
    Change 'Enable 32-bit application' from false to true. (When you create application pool Enable 32-bit application default assign false)

    2) Right click on the project you created the dll and the new referencing project, then select properties. Under Application, check the target framework and verify that both have the same framework, some dll projects tend to select 'client profile' version of the framework by default, which tend to give the error you are having now.

    0 comments No comments