Could not load file or assembly 'Microsoft.ReportViewer.WebForms' - asp.net

I am trying to use the report viewer in asp.net and have uploaded my site. However, when my page containing the report viewer is loaded, it shows the following error:
Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
This is my first time deploying an ASP.NET website, so I'm not sure what the problem is.

This link gave me a clue that I didn't install a required update (my problemed concerned version nr, v11.0.0.0)
ReportViewer 2012 Update 'Gotcha' to be aware of
I installed the update SQLServer2008R2SP2
I downloaded ReportViewer.msi, which required to have installed Microsoft® System CLR Types for Microsoft® SQL Server® 2012 (look halfway down the page for installer)
In the GAC was now available WebForms v11.0.0.0 (C:\Windows\assembly\Microsoft.ReportViewer.WebForms v11.0.0.0 as well as Microsoft.ReportViewer.Common v11.0.0.0)

I've installed Microsoft.ReportViewer.2012.Runtime nuget package and problem has been solved without installing ReportViewer.msi or sql feature pack 12

You need to reference both Microsoft.ReportViewer.WebForms and Microsoft.ReportViewer.Common and set the CopyLocal property to true. This will result in the dll's being copied to our bin directory (both are necessary).

I've solved the problem by copying both
Microsoft.ReportViewer.WebForms.dll from C:\Program Files (x86)\Microsoft Visual Studio 12.0\ReportViewer
and Microsoft.reportviewer.common.dll from C:\Program Files\Microsoft Office\Office15\ADDINS\PowerPivot Excel Add-in
into bin folder (website).
Of course web.config must have:
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
</httpHandlers>
<assemblies>
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
<add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</buildProviders>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</handlers>
</system.webServer>
And that's all.
For me is ok.
Hope this helps.

Updating ReportViewer should works. Use below instruction to install updated ReportViewer from Nuget Package Manager console.
Install-Package
Microsoft.ReportingServices.ReportViewerControl.WebForms
Just add below assembly reference in your aspx file.
Here, 15.0.0.0 is the version number of the ReportViewerControl.WebForms that was installed in my VS. Please check Reference of the Solution to confirm the version number. No need to add PublicTokens (if multiple installation exists, it may creates trouble again).

I ran into the same error. My web app was pointed towards report viewer version 10.0 however if 11.0 is installed it adds a redirect in the 10.0 .dll to 11.0. This became an issue when 11.0 was uninstalled as this does not correct the redirect in the 10.0 .dll. The fix in my case was to simply uninstall and reinstall 10.0.

I had this error with an old webforms app. Turns out there was a line in the markup causing the issue. I removed it and the error disappeared.
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>

I had this error when going from version 10.0.0.0, i.e.
"Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
to version 11.0.0.0, i.e.
"Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
It took a while until I understood that not only the version was changed but also the public token key, as you can see above.

I had the same error for a different package. My problem was that a dependent project was referencing a different version. I changed them to be the same version and all was good.

My solution is:
Copy dll Microsoft.ReportViewer.WebForms.dll into Bin folder in your project.
Remove your reference.
Add new reference from bin folder.
I hope this can help.

Upload the file Microsoft.ReportViewer.WebForms.dll to your bin directory of your web applicaion.
You can find this dll file in the bin directory of your local web application.

My trial version of DevExpress had expired. Try renewing it again.

In order to Run Report Viewer On server with Data from Server
A) Go to Project Property ----> Select Reference ------> Add Reference
1) Import (Microsoft.ReportViewer.Common.dll)-----> (Path "C:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer")
2) Import (Microsoft.ReportViewer.ProcessingObjectModel.dll) -----> (Path "C:\Windows\Assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel")
3) Import (Microsoft.ReportViewer.WebForms.dll)-----> (Path "C:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer")
B) In Above three DLL set its "Local Copy" to True so that while Building Deployment Package it will getcopied to "Bin" folder.
C) Publish the Solution
D) After that Upload all the files along with "Bin" folder with the help of "File Zilla" software to "Web Server".
E) This will install DLL on server hence, client is not required to have "Report Viewer.dll".
This worked for me.

I had the same problem.
I fixed the problem by installing Microsoft-Report-Viewer-2010-Redistributable ("ReportViewer.exe)

Related

Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0

I have developed a simple project. where i have to print some crystal report. the project runs very well in local machine, but when i up this on a web hosting server, it shows me an error when crystal report viewing.
Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'CrystalDecisions.ReportAppServer.CommLayer,
Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'
or one of its dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to
determine why the assembly
'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Please any one can help me .....
I had the same error after moving to a new laptop (Windows 10). In addition to setting Copy Local to true as mentioned above, I had to install the Crystal Reports 32-bit runtime engine for .Net Framework, even though everything else is set to run in a 64-bit environment. Hope that helps.
As I said in comment your crystaldecisions.reportappserver.commlayer.dll is not copied / present on your server. So for this you have to manually copy the dll and paste into you Bin folder
To copy a DLL from visual studio project follow the steps
1.Expand your Project's References hierarchy (Project should not be in debug mod)
2.Right Click on Particular Dll (in your case crystaldecisions.reportappserver.commlayer.dll) and select Properties and set 'Copy Local' attribute to TRUE
3 Build your project. The Dll should be there in your BIN Folder.
I faced the same issue and used the following steps to solve it
1) go Right side in solution explorer
2) Click on your Project Name
3) click on Reference
4) you can see yellow symbol on some DLL
5) Right click on that DLL and go to Property
6) Find Specific Version = True replace it with Specific Version = False
and also change Copy Local = False to Copy Local = True
CR has changed the Version No of Assemblies. The Old Version is 13.0.2000.0 (this is a incompatible version problem). The New Version is 13.0.3500.0 or 13.0.4000.0 - this is for my test case of Visual Studio 2019 and .net 4.7.2 and Window Server 2019. You need to open all your projects, Remove the old dll reference and add the new references. Then build the application again.
I learnt from source:
Best Answer: https://answers.sap.com/questions/303438/could-not-load-file-or-assembly-%27crystaldecisionsr.html
Installation Notes
Crystal Reports for Visual Studio 2017:
https://www.tektutorialshub.com/crystal-reports/crystal-reports-download-for-visual-studio/#Service-Pack-16
TO remove: Right click on an assembly under references to remove it.
This is where the error comes from - it is exactly what the error message outputs:
error message:
Could not load file or assembly ... The located assembly's manifest
definition does not match the assembly reference ...
location error message referring to:
"C:\Visual-Studio-2019-Proj\Proj Windows Inventory\Proj Windows
Inventory\obj\x86\Debug\Press HDL Windows Inventory.exe.manifest"
And it looks like this:
-The older version of .net 3.5 and CReports version="13.0.2000.0" and VS2012:
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="CrystalDecisions.CrystalReports.Engine.dll" size="372736">
<assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" version="13.0.2000.0" publicKeyToken="692FBEA5521E1304" language="neutral" processorArchitecture="msil" />
-The newer version of .net 4.7.2 and CReport version="13.0.4000.0" and VS2019:
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="CrystalDecisions.CrystalReports.Engine.dll" size="373248">
<assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" version="13.0.4000.0" publicKeyToken="692FBEA5521E1304" language="neutral" processorArchitecture="msil" />
Edit Web Config for each CrystalDecisions file version make it same version of the .dll file (Right-click on it and select properties within solution explorer)
For example.
crystaldecisions.reportappserver.commlayer.dll --> 13.0.2000.0
after upgrade crystal report to CRforVS_13_0_21 edit it to ---> 13.0.3500.0
Somehow I had the wrong versions of the DLLs registered in my project.
I removed the three references to the Crystal Report dlls from my project.
I right click References, and click Add Reference
In the popup window, I click the Browse menu on the left and the Browse button
In the Directory window where your DLLs reside (perhaps your application's bin directory), select the three Crystal Reports DLLs and then click Add.
Back at the Reference Manager window, click in the first column to the left of the three Crystal dlls, and then click OK
At this point your Crystal Reports should work again.
I faced the same issue when move to new laptop and used the following steps to solve it
Close the project
Install SAP Crystal Reports 13.0 runtime (32-bit) enter image description here
Delete the project .suo file
Open the Project and first built the project
Now after running the project issue is resolved.
In the first plate you have to check that:
1) You install a appropriate version of Crystal Reports SDK =>
http://downloads.i-theses.com/index.php?option=com_downloads&task=downloads&groupid=9&id=101 (for example)
2) Add reference to dll =>
crystaldecisions.reportappserver.commlayer.dll
For me it was "Prefer 32bit": clearing the checkbox allowed CLR to load Crystal Reports 64bit runtime (the only one installed).
If you already have the DLL copied to your project and the Copy Local flag is in true, the solution should be just rebuild the project. That will copy the DLL to the bin folder.
For visual studio 2019
change the code in aspx.cs page
<%# Register Assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
in web config:
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null"/>
</sectionGroup>
</sectionGroup>
</configSections>
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
<add assembly="Microsoft.ReportViewer.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</assemblies>
<buildProviders>
<add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</buildProviders>
If you have the to your project and the Copy Local flag is in true, the solution should be just the project. That copy the DLL to the bin folder.

Parser Error Message: Could not load file or assembly. But the assembly is there

I do not understand from where this problem comes. I have the correct assembly in the Bin, the same is correctly referenced in the web.config
<compilation targetFramework="4.5" debug="true">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Telerik.ReportViewer.WebForms, Version=8.1.14.804, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"/>
</assemblies>
</compilation>
....
<httpHandlers>
.........
<add path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=8.1.14.804, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" validate="true"/>
</httpHandlers>
the particular feature object of the error is working on my developing machine but on the production server I get this error!
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly 'Telerik.Reporting, Version=8.1.14.804, Culture=neutral, PublicKeyToken=a9d7983dfcc261be' or one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line%70<td%class="leftGridColumn"> </td>
Line%71:<td%class="centerGridColumn">
Line%72<telerik:ReportViewer%ID="ReportViewer1"%runat="server"%Width="100%"%Height="660px"%ShowExportGroup="False"%
Line%73:</td>
Line%74:<td%class="rightGridColumn"> </td>
Any hint will be really appreciated I do not know what else do do to solve this problem.
The only thing I can think of is 'Are you sure you are using the correct/compatible version of the .Net Framework?'. I had a problem a while back when using Asp.Net MVC where it didn't like 4.5, so i had to create a 4.0 project.
EDIT
Just found this on an old blog:
The original warning you receive explains that you should register the handler for the web report viewer in the httphandlers section in the web config. However if you're hosting the application in IIS7, there is a different section to add the handler to, namely the <system.webServer>\<handlers> section:
<system.webServer>
<handlers>
<add name="Telerik.ReportViewer.axd_*" path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=3.2.9.1211, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" preCondition="integratedMode,runtimeVersionv2.0" />
</handlers>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
"it clearly states that it cannot find a necessary assembly you're referencing. During the installation of Telerik Reporting on your machine, the Telerik assemblies were added to GAC. When deploying a Web Site project the assemblies from the GAC are not copied automatically, so you need to copy the assemblies manually from the installation’s Telerik Reporting /bin folder to the bin folder of your application on the server. Full step by step instructions on deploying are included in the Deploying Applications using Telerik Reporting help article."
Here's the link: http://www.telerik.com/forums/web-reportviewer-error

Razor Host Factory error

I get a MvcWebRazorHostFactory error trying to run my app, but it's not an MVC app at all. I have the following web packages installed via nuget:
Microsoft ASP.NET Razor
Microsoft ASP.NET Web API 2.1
Microsoft ASP.NET Web Pages
My app is angularjs front end using razor views (.cshtml). I don't understand why I keep getting this error.
An exception of type 'System.InvalidOperationException' occurred in System.Web.WebPages.Razor.dll but was not handled in user code
Additional information: Could not locate Razor Host Factory type: System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35
And here is the razor section in my web.config:
<system.web.webPages.razor>
<host factoryType="System.Web.WebPages.Razor.WebRazorHostFactory, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.WebPages.WebPage">
<namespaces>
<add namespace="System.Web.Configuration" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
I resolved this issue by setting System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc Version to 5.2.0.0 and it worked, finally! Why 5.2.0.0? Same version as NuGet Microsoft ASP.NET project.
So, the line in /Views/Web.Config should be:
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
For the benefit of anyone developing ASP.NET MVC 5 web apps using Xamarin Studio v5.5.3 on OSX, deleting the /Views/Web.config did not work for me and created other errors.
To fix it, open /Views/Web.config and change all instances of 5.2.0.0 to 5.2.2.0
More details here
Several of the answers point in the right direction, but I was not sure where in the Microsoft Visual Studio for Mac interface I could find the appropriate version number to use for the version part of the factoryType attribute.
For the benefit of other VS for Mac users, the answer is to simply right-click on the Microsoft.AspNet.Mvc package in the Packages list in the solution explorer.
In my case, the package version was "5.2.6" after a package update, so I set the version part of the factoryType attribute to Version=5.2.6.0. This solved the problem.
Changed the version of MvcWebRazorHostFactory to the same version of System.Web.Mvc which resolved my issue.
So apparently some package I got from nuget adds a web.config to the Views folder. In this web.config there were settings for the MvcWebRazorHostFactory. I think this occurred when I added a View to my project using the dialog box.
The solution is to remove the web.config from the Views folder.
I started getting this error in my Razor .cshtml pages in an MVC project following some NuGet package management / upgrading.
I didn't want to remove the Web.config file completely from the Views folder because I had customised it width some <add namespace="..." /> elements. But I noticed that the Version=... in the <host factoryType="..." /> didn't match my version of System.Web.Mvc (checked version in Object Browser).
Altering this version number to match that of my System.Web.Mvc assembly, and restarting Visual Studio, fixed the problem for me (as suggested by Daniel)
This happened to me today. I just made sure the version number for the web.config in the views folder matches the version number for the web.config of the solution.
Hope this helps.
For MacBook users having the Visual Studio 2019, you simply go to the Web.config file and update version of the System.Web.Mvc to that which is in your Nuget packages folder.
Inside your Web project, open "References" tree node.
Look for "Assemblies" folder and open it.
Look for System.Web.Mvc, right click on it, and select "Properties"
A dialog will prompt, read carefully the package full name field and look for the version number. For example, I have this one:
System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
So, in the Web.config (inside Views folder) replace the version number!
In my case, it originally was:
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Now I have (look at the Version value):
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Hope it helps!

visual studio 2k8 (and 2k10) cannot compile web application when gac assemblies are moved into global web.config

I have numerous ASP.NET 3.5 web applications with verbose application-level web.config files which I wish to slim down and make more readable.
Visual Studio 2010 has just arrived and has already started "cleaning up" various sections of the web.config - so now is a perfect time for me to continue the good work and do the same in other areas of the web.config file.
Currently I have several third party assemblies all happily registered in the GAC, these are then referenced in each application-level Web.Config see below;
<configuration>
<system.web>
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<add assembly="AjaxControlToolkit, Version=3.0.30512.20315, Culture=neutral, PublicKeyToken=28F01B0E84B6D53E"/>
<add assembly="aspNetEmail, Version=3.5.2.0, Culture=neutral, PublicKeyToken=BC571E8DA1C1F543"/>
<add assembly="aspNetDns, Version=3.0.0.0, Culture=neutral, PublicKeyToken=BC571E8DA1C1F543"/>
<add assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
</system.web>
</configuration>
I have moved the above compilation-node into the global web.config file located at Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config - and the application runs just fine under IIS7 i.e. the application has no trouble finding these GAC'd assemblies.
however when I now compile (shift+ctrl+b) my web application in visual studio 2k8 or 2k10 I'm getting the familiar error "The type or namespace name 'aspNetDns' could not be found (are you missing a using directive or an assembly reference?)"
What do I have to do to get visual studio to recognise the whereabouts of these GAC'd libraries? I tried copying them into windows\system32 but no joy there...
help! :)
NB: I have also tried working with the machine.config but still no luck
Solved it.
I needed to edit the global web.config in the x86 directory (as well as the x64 version) - the x86 version is obviously the one Visual Studio was looking at whilst compiling the app, whereas IIS was looking at the x64 version of the global web.config when running the app.
Drag / drop the assemblies to c:\windows\assembly on your local machine where you are recompiling.

"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.
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.
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.
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?
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.
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.
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.
Delete everything from BIN Folder and copy all the files from [ASSEMBLIES] in to BIN Folder fixed the problem for me.
Khizer Jalal
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.

Resources