“无效令牌”,“ 在类、结构或接口中” 结账后

发布于 2024-07-25 13:22:16 字数 5024 浏览 2 评论 0原文

我在从 Subversion 中签出 EPiServer Web 应用程序后,在编译它时遇到问题。

我收到这个错误

编译器错误消息:CS1519:类、结构或接口成员声明中的标记“,”无效

源错误:

Line 116:    }
Line 117:    
Line 118:    public virtual EPiServer.Personalization.SubscriptionInfo, EPiServerSubscription Info {
Line 119:        get {
Line 120:            return ((EPiServer.Personalization.SubscriptionInfo, EPiServer)this.GetPropertyValue("SubscriptionInfo")));

源文件:

c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\956e6fc5\66c11597\App_Code.9_fan95p.0.cs    Line: 118 

正如您从错误中看到的,此文件位于“Temporary ASP.NET Files”文件夹中,并且是构建过程的一部分。 这不是我的源代码。

我见过这个问题建议 Web 配置包含类型引用

在“Namespace.ClassName”中指定, 程序集名称”格式。

因此,我进入 web.config 并将该部分更改

...
<profile ...>
    <properties>
        ...
        <add name="SubscriptionInfo"
             type="EPiServer.Personalization.SubscriptionInfo, EPiServer"
             provider="SqlProfile" />
        ...

...
<profile ...>
    <properties>
        ...
        <add name="SubscriptionInfo" 
             type="EPiServer.Personalization.SubscriptionInfo"
             provider="SqlProfile" />
        ...

这消除了上面的直接错误,但随后我对不同的类型遇到了相同的错误。因此,我浏览了“命名空间”中的所有类型.TypeName, AssemblyName”格式并删除了“, AssemblyName”。这停止了所有 CS1519 错误,但随后我开始收到 CS0234:

编译器错误消息:CS0234: 类型或命名空间名称 不存在“个性化” 命名空间“EPiServer”(您是 缺少程序集引用?)

来源错误:
第 116 行: }
117号线:
第118行:公共虚拟EPiServer.Personalization.SubscriptionInfo 订阅信息{
第 119 行:获取 {
120行:返回 ((EPiServer.Personalization.SubscriptionInfo)(this.GetPropertyValue("SubscriptionInfo")));

我使用 VisualStudio 2008、Episerver 5.2.372.7、VisualSVN 1.7.2 和 Debian 盒子作为运行 svn 版本 1.4.2 (r22196) 的 Subversion 存储库。

应用程序构建良好,然后我将其签入存储库。 将其签出到同一台计算机上的不同位置并按 F5,这些错误开始出现。

有没有人有什么建议。

更新: 感谢您的回复,德维奥,扎夫。

我已将以下内容添加到 web.config 的 部分中:

<assemblies>
  <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add assembly="EPiServer, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.BaseLibrary, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Configuration, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Enterprise, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Implementation, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Lucene, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Scheduler, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Web.WebControls, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.WorkflowFoundation, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Wsrp, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.XForms, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
</assemblies>

之前没有 部分。

该项目的参考文献中包含所有这些 DLL。 所有 EPiServer DLL 都在 GAC 中。 新的(非工作)结账位于创建原始项目的同一台计算机上。

我现在得到:

解析器错误消息:无法加载 文件或程序集“EPiServer.Scheduler” 或其依赖项之一。 系统 找不到指定的文件。

(C:\Projects\web\ProvidentPPC2\ProvidentPPC\web.config 第 301 行)

源错误:

Line 299:      <add name="InitializationModule" type="EPiServer.Web.InitializationModule" />
Line 300:      <!--<add name="BasicAuthentication" type="EPiServer.Security.BasicAuthentication, EPiServer" />--> 
Line 301:      <add name="Initializer" type="EPiServer.Scheduler.Initializer, EPiServer.Scheduler" />
Line 302:      <add name="WorkflowRuntime" type="EPiServer.WorkflowFoundation.WorkflowSystem" />
Line 303:      <add name="UrlRewriteModule" type="EPiServer.Web.UrlRewriteModule" />  

源文件:

C:\Projects\web\ProvidentPPC2\ProvidentPPC\web.config
Line: 301

正如我所说,EPiServer.Scheduler 在我的 GAC 中并添加以项目为参考。 任何更多的想法将不胜感激。

I am having problems compiling an EPiServer Web Application after checking it out of Subversion.

I get this error

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

Source Error:

Line 116:    }
Line 117:    
Line 118:    public virtual EPiServer.Personalization.SubscriptionInfo, EPiServerSubscription Info {
Line 119:        get {
Line 120:            return ((EPiServer.Personalization.SubscriptionInfo, EPiServer)this.GetPropertyValue("SubscriptionInfo")));

Source File:

c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\956e6fc5\66c11597\App_Code.9_fan95p.0.cs    Line: 118 

As you can see from the error, this file is in the "Temporary ASP.NET Files" folder and is part of the build process. This is not my source code.

I have seen this question which suggests that the web config contains type references

specified in the "Namespace.ClassName,
AssemblyName" format.

So I went into my web.config and changed the section

...
<profile ...>
    <properties>
        ...
        <add name="SubscriptionInfo"
             type="EPiServer.Personalization.SubscriptionInfo, EPiServer"
             provider="SqlProfile" />
        ...

to

...
<profile ...>
    <properties>
        ...
        <add name="SubscriptionInfo" 
             type="EPiServer.Personalization.SubscriptionInfo"
             provider="SqlProfile" />
        ...

This removed the immediate error above but then I got the same error for a different type. So I went through all the types that were in "Namespace.TypeName, AssemblyName" format and removed the ", AssemblyName". This stopped all the CS1519 errors but then I start getting CS0234:

Compiler Error Message: CS0234: The
type or namespace name
'Personalization' does not exist in
the namespace 'EPiServer' (are you
missing an assembly reference?)

Source Error:
Line 116: }
Line 117:
Line 118: public virtual EPiServer.Personalization.SubscriptionInfo
SubscriptionInfo {
Line 119: get {
Line 120: return
((EPiServer.Personalization.SubscriptionInfo)(this.GetPropertyValue("SubscriptionInfo")));

I am using VisualStudio 2008, Episerver 5.2.372.7, VisualSVN 1.7.2 and a Debian box as the Subversion repo running svn version 1.4.2 (r22196).

The application built fine, then I checked it in to the repo. Checked it out to a different location on the same computer and hit F5 and these errors start to appear.

Does anyone have any suggestions.

UPDATE:
Thanks for your replies devio, Zhaph.

I have added the following to my web.config in the <compilation> section:

<assemblies>
  <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add assembly="EPiServer, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.BaseLibrary, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Configuration, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Enterprise, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Implementation, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Lucene, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Scheduler, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Web.WebControls, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.WorkflowFoundation, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.Wsrp, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
  <add assembly="EPiServer.XForms, Version=5.2.375.7, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"/>
</assemblies>

There was no <assemblies> section previously.

The project has all of those DLLs in its References. All the EPiServer DLLs are in the GAC.
The new (non-working) checkout is on the same machine that the original project was created on.

I now get :

Parser Error Message: Could not load
file or assembly 'EPiServer.Scheduler'
or one of its dependencies. The system
cannot find the file specified.

(C:\Projects\web\ProvidentPPC2\ProvidentPPC\web.config line 301)

Source Error:

Line 299:      <add name="InitializationModule" type="EPiServer.Web.InitializationModule" />
Line 300:      <!--<add name="BasicAuthentication" type="EPiServer.Security.BasicAuthentication, EPiServer" />--> 
Line 301:      <add name="Initializer" type="EPiServer.Scheduler.Initializer, EPiServer.Scheduler" />
Line 302:      <add name="WorkflowRuntime" type="EPiServer.WorkflowFoundation.WorkflowSystem" />
Line 303:      <add name="UrlRewriteModule" type="EPiServer.Web.UrlRewriteModule" />  

Source File:

C:\Projects\web\ProvidentPPC2\ProvidentPPC\web.config
Line: 301

As I say EPiServer.Scheduler is in my GAC and added to the project as a reference.
Any more ideas would be greately appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

时光沙漏 2024-08-01 13:22:17

我在重建项目中的 dll 引用时遇到了这个问题。

我已将外部/第三方 dll 从 bin 文件夹移动到 Web 项目根目录之外的库文件夹。

我的问题是一些 dll 引用没有将本地复制设置为 true,因此它们从未在构建时复制到 bin 文件夹中。

I encountered this problem as I was restructuring the dll references in a project.

I had moved the external/third part dlls from the bin folder to a library folder outside the web project root.

My problem was that some of the dll references did not have copy local set to true, so they were never copied to the bin folder on build.

活泼老夫 2024-08-01 13:22:17

自从我问这个问题以来已经有一段时间了,我一直在思考我需要记住问题是什么并发布答案。 我觉得这就是。

事实证明,应用程序查找 EPiServer 安装的 DLL 时出现问题。 我不太确定,一旦我有机会在干净的机器上尝试一下,我就会更新这篇文章,我仍处于项目中期,所以现在不是一个闲逛的好时机。

我解决这个问题的方法是从 c:\Program Files\EPiServer\CMS\VERSION\bin 获取 DLL,并将它们放入应用程序的 bin 文件夹中。

一旦我有机会在某个地方进行全新安装,我就会看看它是否实际上是该项目(我对此表示怀疑),或者更可能的是我的计算机上的安装已损坏。

It's been a while since I asked this and I keep looking thinking that I need to remember what the issue was and post the answer. I think this is it.

It turned out that there was an issue with application finding the DLLs that EPiServer installed. I'm not sure exactly and I'll update this post once I get chance to try it out on a clean machine, I'm still mid-project so it's not a very good time to be faffing about.

The way I fixed it was to get the DLLs from c:\Program Files\EPiServer\CMS\VERSION\bin and put them in the bin folder for the application.

Once I get chance to do a clean install somewhere I'll see if it is infact the project (which I doubt) or, more likely, the installation on my computer which is broken.

无戏配角 2024-08-01 13:22:17

您是否尝试过正确引用 EPiServer 程序集?

我假设它在解决方案资源管理器的项目引用节点中显示正常,并且上面没有黄色的惊叹号覆盖?

也许您也可以在 web.config 编译部分引用它:

<compilation debug="false">
  <assemblies>
    [...]
    <add assembly="Episerver, Version=5.2.372.7"/>
  </assemblies>
</compilation>

您可能不需要版本号,或者您可能需要添加版本号和区域性类型 - 那里应该已经引用了一些其他程序集以供参考。

您还可以尝试:

<add assembly="EPiServer" />

和其他变体。


听起来像是程序集加载问题:

检查 EPiServer DLL 是否可以在您的新位置访问 - 它是否安装到您计算机的全局程序集缓存中,或者它是对 /bin 文件夹的本地引用? dll在bin文件夹下吗? dll 是否包含在源代码管理中?

Have you tried referencing the EPiServer assembly correctly?

I assume that it's displaying ok in the project references node in the Solution Explorer, and hasn't got a yellow exclaim overlay on it?

Perhaps you could reference it in the web.config compilation section as well:

<compilation debug="false">
  <assemblies>
    [...]
    <add assembly="Episerver, Version=5.2.372.7"/>
  </assemblies>
</compilation>

You may either not need the version number, or you may need to add the version number and culture type - there should be a few other assemblies referenced in there already for reference.

You could also try:

<add assembly="EPiServer" />

and other variations.


Sounds like an Assembly Load issue then:

Check that the EPiServer DLL is accessable in your new location - is it installed to your computers Global Assembly Cache, or is it a local reference to the /bin folder? Is the dll in the bin folder? Is the dll included in source control?

jJeQQOZ5 2024-08-01 13:22:17

我遇到过这个问题好几次,当我手动将 EPiServer 程序集复制到 bin 文件夹时,我就完成了这个任务。 这确实有效,但不是很优雅。 Zhaph 的带有程序集标签的解决方案看起来好多了,我下次会尝试一下。

I ran into this several times and done it for me is when I manually copied the EPiServer assemblies to the bin folder. That works for sure but it's not very elegant. Zhaph's solution with the assemblies tag looks much nicer I'll try it next time.

慕巷 2024-08-01 13:22:17

我今天下午刚刚遇到了类似的问题。 问题是 EpiServer dll 不存在于网站的 bin 目录中,因此我遇到了绑定失败。

该项目是由我的一位同事创建的,相关的 EpiServer dll 作为解决方案项目添加到 lib 文件夹中并从那里引用。 然而,由于他最初是从 EpiServer 项目模板创建的,因此这些库也自动添加到 bin 文件夹中。 当他更新引用以指向 lib 文件夹时,复制本地默认为 false。 由于模板将原始副本放置在 bin 文件夹中,因此这在他的计算机上仍然有效。 将它们更新为 CopyLocal = True 解决了该问题。

I just had a similar problem this afternoon. The problem was that the EpiServer dlls were not present in the bin directory of the website, so I got bind failures.

The project had been created by one of my colleagues and the relevant EpiServer dlls were added as solution items in a lib folder and referenced from there. However, as he had initially created it from the EpiServer project template, the libraries had automatically been added to the bin folder also. When he updated the references to point to the lib folder, copy local defaulted to false. This still worked on his machine due to the original copies placed in the bin folder by the template. Updating them to CopyLocal = True fixed the issue.

地狱即天堂 2024-08-01 13:22:17

我刚刚在 EPiServer 站点上再次遇到了同样的问题。 这是因为我引用了 EPiServer DLL,但它们没有在所有引用上将“复制到本地”属性设置为 true,因此它们并未全部放置在 bin 目录中。

I just had this same problem, again with an EPiServer site. It was because I was referencing the EPiServer DLLs, but they did not have the "copy to local" property set to true on all the references, and so they were not all being placed in the bin directory.

嘿看小鸭子会跑 2024-08-01 13:22:17

删除 BIN 文件夹中的所有内容,并将 [ASSEMBLIES] 中的所有文件复制到 BIN 文件夹中,这解决了我的问题。

凯泽·贾拉尔

Delete everything from BIN Folder and copy all the files from [ASSEMBLIES] in to BIN Folder fixed the problem for me.

Khizer Jalal

流殇 2024-08-01 13:22:17

我猜最初的错误消息意味着您有一个格式错误的 C# 表达式,

return ((EPiServer.Personalization.SubscriptionInfo, EPiServer)...

与配置文件无关。

可能您输入的是“,”而不是“。” ? (当编译器读取此内容时,您在转换中提供 2 种类型)

将 web.config 恢复为其原始版本并修复拼写错误,这应该可以工作。

Greg 评论后更新:

我没有意识到您发布的配置部分是 EPIServer 配置的一部分。 你当时删除程序集名称是对的。

不过我想您需要从 Web 应用程序引用 EPiServer(添加引用...)。 我想我在我的项目中也注意到了这一点:如果您将 ASP.Net 应用程序签出到新位置,则需要再次添加所有引用。

I guess the original error message meant you had a malformed C# expression in

return ((EPiServer.Personalization.SubscriptionInfo, EPiServer)...

nothing to do with the config file.

Probably you typed "," instead of "." ? (As the compiler reads this, you provide 2 types in the cast)

Revert web.config to its original version and fix the typo, that should work.

update after Greg's comment:

I didn't realize the config section you posted were part of the EPIServer configuration. You were right then to remove the assembly names.

However I guess you need to reference the EPiServer from the web app (Add Reference...). I think I noticed this in my projects too: If you checkout an ASP.Net app to a new location, you need to add all references again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文