Error with continuousintegration.exe

James Phillips asked on June 7, 2021 15:05

Hi I wonder if anyone can help? I've upgraded my K12 solution to K13 via KIM and also used KIM to apply hotfix 13.

The solution is compiling and running without issue. However when I try and run continuousintegration.exe I get the following error:

C:\Files\Working Copies\LocalGitRepo\nas-websites\Nas.KenticoSites\CMS\bin>continuousintegration.exe -r
Continuous Integration Console
Kentico Software
System.IO.FileLoadException: Could not load file or assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
   at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at CMS.Core.TypeManager.<>c__DisplayClass28_0.<GetAssembliesWithAttributeOfType>b__0(Assembly a)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at CMS.Core.TypeManager.GetAssemblies[T]()
   at CMS.Core.TypeManager.PreInitializeTypes()
   at CMS.Core.ModuleEntryManager.PreInit()
   at CMS.Core.AppCore.PreInit()
   at CMS.DataEngine.CMSApplication.PreInit(Boolean initializeContainer)
   at CMS.ContinuousIntegration.ConsoleApp.Program.InitKenticoApplication(String webAppPhysicalPath)
   at CMS.ContinuousIntegration.ConsoleApp.Program.Main(String[] args)

=== Pre-bind state information ===
LOG: DisplayName = System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/Files/Working Copies/LocalGitRepo/nas-websites/Nas.KenticoSites/CMS/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : CMS.WebApi, Version=13.0.13.0, Culture=neutral, PublicKeyToken=834b12a258f213f9.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Files\Working Copies\LocalGitRepo\nas-websites\Nas.KenticoSites\CMS\bin\ContinuousIntegration.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Files/Working Copies/LocalGitRepo/nas-websites/Nas.KenticoSites/CMS/bin/System.Web.Http.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

All the Kentico DLL references look right in the sense they are 13.0.13.0, however it seems to be looking for an older version of System.Web.Http, am I missing something?

Thanks

Recent Answers


Dmitry Bastron answered on June 7, 2021 17:48

Hi James,

What version of System.Web.Http do you have in your bin folder? Do you have any binding redirects in config files?

Also, after upgrading the solution, did you do full solution clean and then rebuild? If you only do rebuild without cleaning VS is not always cleaning the bin folder for you so it may contain old libraries.

0 votesVote for this answer Mark as a Correct answer

James Phillips answered on June 8, 2021 10:57 (last edited on June 8, 2021 10:58)

Hi Dmitry, thanks for looking!

Looking at the file properties via the bin folder the product version is 5.2.7-61128 for the System.Web.Http.dll.

Yes I manually deleted all items in the bin folder and obj folder and rebuilt several times now. However I didn't manually clean the build folder before first run, although I did use the 'rebuild' command after upgrading and before first run which cleans the bin prior to build.

From visual studio's point of view..

CMS project solution explorer reference properties: Version = 5.2.7.0, Path = C:\Files\Working Copies\LocalGitRepo\nas-websites\Nas.KenticoSites\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll

CMS project csproj file: <Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

CMS Web.Config binding redirect: <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />

So that looks fine, and the CMS site runs ok. So the issue seems to be specifically the continuousintegration.exe that is created on build. I looked for any binding redirects in the ContinuousIntegration.exe.config file but there are no instances of any redirects for System.Web.Http

0 votesVote for this answer Mark as a Correct answer

James Phillips answered on June 8, 2021 11:23

I compared the reference to a fresh install of K13, which references System.Web.Http 5.2.3.0!

So, somehow we had updated the package in the process, if I change the nuget package back to 5.2.3.0 and remove the binding redirect from web.config continuous integration works again as does the CMS..

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.