I'm currently upgrading from 4.3 to 4.6 which means changing everything to async in service references (in the plugin) along with some other braking changes.
Both plugins are now upgraded but I have issues in the theme where I no longer can reference classes from the plugins.
Below is a sample of how _CheckoutAttributes.cshtml is layed out. It's located in Nop.Web/Themes/ThemeName/Views/Shared.
I've changed some of the naming to "ProjectName" to keep privacy.
@using System.Text
@using Nop.Core.Domain.Catalog
@using Nop.Core.Domain.Media
@using Nop.Services.Media
@using Nop.Services.Orders
@using Nop.Core
@using Nop.Plugin.Misc.ProjectName.Services
@inject IDownloadService downloadService
@inject CatalogSettings catalogSettings
@inject ICheckoutAttributeService checkoutAttributeService
@inject IStoreContext _storeContext
@inject IProjectNameCheckoutAttributeService projectNameCheckoutAttributeService
@inject IWebHelper _webHelper
@{
var checkoutAttributes = projectNameCheckoutAttributeService.GetCheckoutAttributes();
}
<form method="post" enctype="multipart/form-data" id="checkout-attributes-form">
etc...
The error I get is The type or namespace name 'Plugin' does not exist in the namespace 'Nop' (are you missing an assembly reference?)
This used to work in nopCommerce 4.3 but no matter what I try now (clean, rebuild etc) it wont build.
In 4.3 the Intellisense actually gave the same error but the compilation of the project/solution still was successful.
Any input on how to solve this?
I've tried rebuilding, cleaning, restarting Visual Studio, keeping the cshtml files closed.
I've also tried referencing other standard plugins to see if it's a problem relating to only my plugins. But that also failed.
It seems like nopCommerce 4.6 or perhaps rather dot.net core 7 is more strict about being able to compile the razor files. Or perhaps it has something to do with Visual Studio?
I looked into if I can choose to only compile the razor files when loading them but can't seem to find a way to turn off building them at compile time.