question

DerishanV-4248 avatar image
0 Votes"
DerishanV-4248 asked PranamK-0159 answered

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

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.

dotnet-csharpvs-msbuildoffice-vsto-com-dev
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

Experts in this forum kindly have a look and give some input.
I am not sure if this is the bug in VSTO.
Please have a look.

0 Votes 0 ·

Is it possible that the program is 32-bit and your office is 64-bit? To be honest, this question has nothing to do with c#, so I am not sure

0 Votes 0 ·

The program is Ant-CPU and Office is 32 bit.

0 Votes 0 ·

1 Answer

PranamK-0159 avatar image
0 Votes"
PranamK-0159 answered

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.