logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Jay  
#1 Posted : Wednesday, April 29, 2020 10:30:00 AM(UTC)
Jay

Rank: Member

Groups: Authorized User, Developers
Joined: 11/12/2018(UTC)
Posts: 25

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
Using AC 9.0.2 with Source, Visual Studio 2019 Pro, Target Framework .NET Framework 4.6.2

I'm trying to develop a Plug-in. I am running into the following issues.

AbleCommerce's Sample Plug-ins from GitHub
When I open the Index.cshtml file, I get errors like:
Code:
Error	CS8023	Feature 'lambda expression' is not available in C# 2. Please use language version 3 or greater.

Also, there are red squiggly lines under things like ViewBag with the message "The name 'ViewBag' does not exist in the current context".

AbleCommerce's AvaTax Integrated Provider project
Same errors and messages as above.

Any ideas on how to get the samples or integrated provider projects to load without errors?

Creating my own Plug-in project
If I create a new "ASP.NET Web Application (.NET Framework)" project and choose MVC, everything seems fine until I add a reference to CommerceBuilder.dll. Then (after closing/opening the project) in the Index.cshtml file for code such as
Code:
@Html.HiddenFor(m => m.SaveOnly)

and
Code:
@Html.CheckBoxFor(m => m.UseDebugMode)

I get the following error:
Code:
Error	CS0012	The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Also, I see the following error referencing line 1 of the Index.cshtml file:
Code:
Error	CS0234	The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

If I remove the reference to CommerceBuilder.dll and remove the dll from the bin folder, the errors go away (after closing/opening the project).

Based on what I've been able to find by searching the web, these last 2 errors seem related to a version issue with System and/or System.Core and/or System.Web.Mvc. When I look where the answers say the problems might be, everything seems to match. I have tried adding the System.Core reference several places, but that doesn't help.

Any ideas how to resolve any of this?

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Naveed Ashraf  
#2 Posted : Wednesday, April 29, 2020 10:59:22 AM(UTC)
Naveed Ashraf

Rank: Advanced Member

Groups: Admin, Administrators, Developers, Registered, HelpDesk, Authorized User
Joined: 7/31/2019(UTC)
Posts: 77

Was thanked: 8 time(s) in 8 post(s)
You can safely ignore these errors in *.cshtml view files. You can close the view files after editing and you will be able to build the plugin project without any issues.

I will look into these issues. Thanks for reporting.
Thanks for your support!
Naveed Ashraf
Ablecommerce.com
Developer Assistance Available
Jay  
#3 Posted : Wednesday, April 29, 2020 11:24:06 AM(UTC)
Jay

Rank: Member

Groups: Authorized User, Developers
Joined: 11/12/2018(UTC)
Posts: 25

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
Thank you Naveed. The errors prevent IntelliSense from working for some things while adding/editing view code. I rely on IntelliSense a lot, since I haven't done much with .NET MVC and Razor.
sweeperqb  
#4 Posted : Friday, March 26, 2021 12:43:45 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
Any progress on this? I am encountering the same issue. Plugins compile, but no Intellisense for views despite having all of the required packages installed. Happens with a plugin created from scratch, and the Samples from Github.
mazhar  
#5 Posted : Monday, March 29, 2021 12:11:14 PM(UTC)
mazhar

Rank: Administration

Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered
Joined: 10/5/2018(UTC)
Posts: 175

Thanks: 8 times
Was thanked: 17 time(s) in 15 post(s)
Please make sure that you copy Website/Views/Web.config file to your plugin's views folder.
sweeperqb  
#6 Posted : Monday, March 29, 2021 12:37:24 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
Yep, did that. Like I mentioned, the AC samples exhibit the same behavior directly from GitHub, without any customizations. I don't think VS 2019 likes MVC 5 stuff in regular class library projects.

Just a few minutes ago I finally got Intellisense working after hours of trying to figure it out. I ended up unloading my plugin, renamed the directory, then started a new plugin using an Empty .Net Framework Web Project as the baseline. I downgraded the MVC NuGet packages so they matched what AC 9.0.3 was using, added the CommerceBuilder and CommerceBuilder.Web references, then rebuilt my plug-in code from there. Intellisense appears to be working correctly in Razor views now. So I guess the work-around is to start from a .Net Framework Web Project instead of a Class Library.
sweeperqb  
#7 Posted : Monday, April 12, 2021 9:11:07 AM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
Well, my work-around above only fixed some of the errors. Many of the HTML helpers were still broken. To give you an idea of the scope of things, this is what the AC9 plug-in samples look like without any modifications...

ac9-errors.png (30kb) downloaded 5 time(s).

Any suggestions on setting up the environment so we can avoid the UI errors? Is there a specific version of Visual Studio or an SDK or MVC version I need to install locally?
sweeperqb  
#8 Posted : Thursday, April 15, 2021 12:43:23 AM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
I had posted instructions to get it working, but when I tried again today, Intellisense was not working again. Not sure what else to try.
sweeperqb  
#9 Posted : Friday, April 16, 2021 8:15:38 AM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
I am curious if the official AC developers experience the same issue when developing plug-ins? This is a major pain. If you do not have the same issues, please let us know which IDE and SDKs you are using. I've tried every suggestion I could find via web search. It works fine when writing plug-ins for a different .Net cart, but they were using .Net Core and are now using .Net 5. Wondering if it is a Framework issue, or configuration issue
mazhar  
#10 Posted : Monday, April 19, 2021 4:53:19 AM(UTC)
mazhar

Rank: Administration

Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered
Joined: 10/5/2018(UTC)
Posts: 175

Thanks: 8 times
Was thanked: 17 time(s) in 15 post(s)
Please go ahead and try this. Right Click your plugin project and choose to unload the project. Now Right click again the unloaded project and choose to edit it. Locate the following entry in project file.
Code:

<ProjectGuid>{----------------------}</ProjectGuid>

where {-------------------} will be some GUID value in your case.

Now add the following line under it
Code:

<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>


It should be something like this once you are done.
Code:

<ProjectGuid>{----------------------}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>


Now, find the following entry in project file.
Code:

<Import Project="-------------------------">

and add the following line under it
Code:

<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />


It should be something like this once you are done.
Code:

<Import Project="-------------------------">
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />


save your changes, right click project name in solution explorer and choose to load the project. Reopen the View Files for plugin project and see if it makes any difference.
sweeperqb  
#11 Posted : Monday, April 19, 2021 8:43:53 AM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
That appears to have converted it from a Class Library project to a Web Application Project. Unfortunately, it still had syntax errors, even after restarting Visual Studio :(

Based on your suggestion, I'm assuming you are not having the same issues? What version of Visual Studio are you using?
Users browsing this topic
Guest (6)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.