简体   繁体   中英

Parser Error Message when adding new C# Webform with codebehind inside .vbproj solution

So I've inherited a .vbproj that was created using Visual Web Developer Express 2010. Inside the project file there are aspx.vb and aspx.cs files. The program works fine until I've added new C# class. Here are the steps that I did when I created the new C# webform and class:

1. I've created the new C# webform (CreateOrder.aspx) and the code behind file (CreateOrder.aspx.cs) in a separate project.

I did this because Visual Web Developer Express 2010 won't let me add C# webform and class (.cs) inside the existing .vbproj.



2. Then I copy and pasted the C# webform with the code behind file to the existing .vbproj solution.

3. When I run the program and open the webform.aspx, I'm getting the following error:

[Parser Error Message: Could not load type 'CreateOrder'.<br>
<%@ Page Title="Create Order" Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="CreateOrder.aspx.cs" Inherits="CreateOrder"%>]

Solution Explorer



I understand that it couldn't find the CreateOrder class which is clearly inside the code behind class (CreateOrder.aspx.cs). I have it declared as public class CreateOrder : System.Web.UI.Page

The weird thing is there's a lot of existing C# webforms with code behind class inside the existing .vbproj. Not sure why my newly created class is throwing the Parser error message. Please help guys. Thanks!

Try importing your CreateOrder class. This will link the assembly for that class to the current project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM