Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Optimizely CMS 11 to 12 migration using upgrade-assistant tool

Vote:
 

We used upgarde-assistant tool to upgrade project from CMS 11 to 12 and fixed errors in code files. But there are some errors pointed out in view files as shown in below image and those line number within error message doesn't match to line numbers in view. 

Please help if anybody is aware what is causing these errors.

#281143
May 31, 2022 9:21
Vote:
 

This is most likely an error which occurs due to syntax error. Check your curly braces and make sure fields and methods are not accidently out of the scope of their class.

#283505
Jul 11, 2022 13:23
Vote:
 

I've encountered some similar errors in the views before. What worked for me was deleting the files in the obj, bin and packages folders — then restarting and rebuilding the solution just in case.

#283544
Edited, Jul 11, 2022 23:39
Vote:
 

Hello,

Now I have encountered this issue when I run the application

info: EPiServer.Framework.Initialization.InitializationEngine[0]
      Initialization started
fail: EPiServer.Framework.Initialization.InitializationEngine[0]
      Initialize action failed for 'Initialize on class EPiServer.Data.DataInitialization, EPiServer.Data, Version=12.5.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'
      System.InvalidOperationException: Unable to resolve service for type 'EPiServer.Marketing.KPI.Dal.KpiDatabaseContext' while attempting to activate 'EPiServer.Marketing.KPI.Dal.BaseRepository'.
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters,
Boolean throwIfCallSiteNotFound)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type)
         at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters,
Boolean throwIfCallSiteNotFound)

So added the solution as suggested in this blog post https://kunalshetye.com/posts/add-a-b-testing-to-cms12/

But this line services.AddABTesting(_configuration.GetConnectionString("EPiServerDB")); gives error for AddABTesting() method. Anybody know if it's predefined within IServiceCollection or need to create new method? 

#283573
Jul 12, 2022 16:19
Vote:
 

Hey

  1. you need to register DBContexts explicitly where you are registering other services.
  2. you need to do it the Microsoft.Extensions.DependencyInjection way, something like :

                    epiServices.AddScoped<KpiDatabaseContext>(e.Services, x =>

                    {

                        return new KpiDatabaseContext(x.GetRequiredService<IConfiguration>(), "EPiServerDB");

                    });

episervices here is EPiServer.ServiceLocation.ServiceLocationExtensions.

Hope this helps!

#287742
Sep 20, 2022 17:23
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.