我刚刚开始创建我的网站(从头开始创建一个空项目),但遇到一些错误,但我真的很困惑!

Default.aspx

<%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="MonoLightTech.WebSite.Default" %>
<html>
    <head>
        <meta charset="utf-8" />
        <title>MonoLight Technology</title>
    </head>
    <body>
        <%= MonoLightTech.WebSite.Style.TestField %>
    </body>
</html>


Style.cs(BuildAction:编译)

namespace MonoLightTech.WebSite
{
    public static class Style
    {
        public static string TestField = "MonoLight Technology";
    }
}


解决方案层次结构



Visual Studio:我也注意到,VS可以看到Style类和TestField成员



我已经是C#程序员(台式机),并且可以肯定,成员访问没有问题。我还重新打开了项目,清理了解决方案并重新构建了项目。怎么了?我想应该很简单:)

编辑:Here is the solution project with all sources including all assets >>

最佳答案

终于,我明白了怎么了。我已将Output path.\更改为bin\,并且可以使用。我真的不知道为什么,但这是我的解决方案。也许有人可以稍后为我们解释(我希望)。而且我认为,从头开始并非总是最好的方法:)

10-04 14:31
查看更多