Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Invalid token ',' in class, struct, or interface" after checkout

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.

like image 824
Greg B Avatar asked Jul 02 '09 08:07

Greg B


People also ask

How do I fix error cs1519?

Any class, struct, or interface member declaration that contains invalid modifiers before the type will generate this error. To fix the error, remove the invalid modifiers.

What is invalid token in C#?

If you receive an “Invalid Token” error when attempting to sign in or reset your password, the link you are using may have expired. This error can be addressed by generating a new link.


2 Answers

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.

like image 118
Fredrik Stolpe Avatar answered Oct 01 '22 10:10

Fredrik Stolpe


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.

like image 23
Greg B Avatar answered Oct 01 '22 11:10

Greg B