解决编译器错误CS1519:无效令牌','类,结构或接口成员声明 [英] Resolving compiler error CS1519: Invalid token ',' in class, struct, or interface member declaration

查看:1256
本文介绍了解决编译器错误CS1519:无效令牌','类,结构或接口成员声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在上使用Web应用程序项目文件,因此编译为一个dll,而不是你的老式网站项目做部署源$ C ​​$ c。将ASP.NET 2.0中的网站。

I'm working on an ASP .NET 2.0 site which uses a Web Application project file, and therefore compiles to a dll rather than deploying the source code as you do with the older style Web Site projects.

该网站的工作我的测试服务器(Windows Server 2003 R2,IIS6)细,当它在一个网站的根目录下运行。不过,我需要一个虚拟目录下运行它来代替。当我切换到的是,我得到的网站浏览到任何页面下误差

The site works fine on my test server (Windows Server 2003 R2, IIS6) when it runs in the root of a website. However I need to run it under a virtual directory instead. When I switch over to that, I get the following error on browsing to any of the pages in the site

CS1519:无效令牌','类,结构或接口成员声明

CS1519: Invalid token ',' in class, struct, or interface member declaration

错误消息进入到告诉我行号和code文件,然而code文件是临时的ASP.NET文件的文件夹下,当我试图找到它,它不存在。

The error message goes onto tell me the line number and code file, however the code file is under the Temporary ASP .NET files folder and when I try to find it, it's not there.

因此​​我无法找出哪些页面造成的问题,虽然我怀疑这可能是母版页,如果在所有页面上会出现此错误。有没有人其他人看到这种或找到了解决办法?

As such I'm unable to work out which page is causing the issue although I suspect it could be the master page, if this error occurs on all pages. Has anyone else seen this before or found a solution?

推荐答案

原来,问题是有关继​​承上述虚拟层次矿网站的配置设置。

Turns out the problem was related to inheriting the config settings of the site above mine in the virtual hierarchy.

该网站使用其属性在配置文件下的System.Web,型材,属性定义自定义配置文件。该类型的特性之一是在Namespace.ClassName,的AssemblyName的格式指定。

That site uses a custom profile whose properties are defined under system.web, profile, properties in the config file. The type of one of the properties was specified in the "Namespace.ClassName, AssemblyName" format.

当我从最终删除了的AssemblyName的问题自行解决,因为我想摆脱,这是无效的令牌逗号。

When I removed the ", AssemblyName" from the end, the issue resolved itself, because I'd got rid of the comma that was the invalid token.

我只能假设,当ASP .NET编译在运行时的页面,那一定是在编译的配置文件类太强了,用code生成期间在配置文件中定义的属性。

I can only assume that, when ASP .NET compiles pages at runtime, it must have been compiling the profile class too, and using the property definitions in the config file during the code generation.

这篇关于解决编译器错误CS1519:无效令牌','类,结构或接口成员声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆