我正在尝试设置一个简单的aspx页面来演示c#类的功能,MarkdownSharp。该类在一个单独的.cs文件中位于其自己的命名空间中。没有vs项目设置,只有一个独立的aspx文件和一个独立的.cs文件。
在.aspx
文件中,我设置了Page
指令,如下所示:
<%@ Page Language="C#" codefile="~/bfadmin/aspx/Markdown.aspx.cs" Inherits="MarkdownSharp.Markdown" %>
<script runat="server" language="c#">
protected void Page_Load(object sender, EventArgs e)
{
var md = new Markdown();
string html = md.Transform("*3234*");
Response.Write(html);
}
</script>
codeFile包含在名称空间中,如下所示(此处为完整文件:https://github.com/balpha/markdownsharp):
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Text.RegularExpressions;
namespace MarkdownSharp
{
public class MarkdownOptions
{
...
}
public class Markdown
{
...
}
}
当我运行aspx页面时,我会得到类似的结果:
CS0260: Missing partial modifier on declaration of type 'MarkdownSharp.Markdown'; another partial declaration of this type exists