error MSB4018 The SetInclusionListEntry task failed unexpectedly RRS feed

  • Question

  • Hi,

    Working on an Excel 2010 add in, C# .NET 3.5, VSTO 4.0, Visual Studio 2010, Windows 7 64-bit.

    I get the following error when building:


    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(651,9): error MSB4018: The "SetInclusionListEntry" task failed unexpectedly.

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(651,9): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Tools.Office.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

    I have an assembly reference to Microsoft.VisualStudio.Tools.Office.Runtime v.9.0 in my project, this is under Program files (x86)\Reference Assemblies, that dll is definitely there. Because I'm on a 64-bit machine version 10 goes under Program Files\Reference Assemblies, so I do have version 10 under there. It's no wonder that it can't find v10 under x86 because it's not there, but I really don't know why MSBuild is even looking for version 10 of a dll if I've referenced version 9... Any pointers/help? Is there something I can change in my csproj to stop this from happening?

    Edit: If it helps I just found out that the MSBuild is using targets files under c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\ rather than v9.0. If I look at the targets file it specifies Microsoft.VisualStudio.Tools.Office.Runtime, Version=, when really I want Version="". Presumably I can fix this by making msbuild use targets files under c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\... ? Is this correct? Any idea how I can do that?
    Thanks again,


    Thursday, August 11, 2011 1:00 PM


  • Hi Richard,

    As far as I can see, you create an Excel 2010 add-in in your 64-bit development machine. And the add-in has a reference to 32-bit runtime assembly? Please correct me if I have any misunderstood.

    If so, I think you need to use 64-bit version VSTO runtime. The runtime version requested is correspond with edition of Windows rather than edition of Office. You can check this from this document:

    Additionally, I would like to ask you why do you want to add VSTO runtime assembly manually? When you create an Excel add-in, such assembly as Microsoft.Office.Tools.dll, Microsoft.Office.Tools.Common.dll, Microsoft.Office.Tools.Excel.dll and so on will be added to the reference collection automatically.

    I look forward to hearing of you.

    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, August 12, 2011 7:33 AM