"Invalid token ',' in class, struct, or interface" after checkout - asp.net

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.

Related

Reference required to assembly System.Runtime [duplicate]

I'm preparing a brand new ASP.NET MVC 5.1 solution. I'm adding in a bunch of NuGet packages and setting it up with Zurb Foundation, etc.
As part of that, I've added a reference to an in-house NuGet package which is a Portable Class Library and I think this is causing a problem on the build server.
TeamCity fails the build with:
The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0
I originally added the fix for the same or similar error when compiling the Razor web pages, that fix being in the web.config
<compilation ... >
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
However, the issue is unresolved.
To implement the fix, first expand out the existing web.config compilation section that looks like this by default:
<compilation debug="true" targetFramework="4.5"/>
Once expanded, I then added the following new configuration XML as I was instructed:
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
The final web.config tags should look like this:
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
Adding a reference to this System.Runtime.dll assembly fixed the issue:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Runtime.dll
Though that file in that explicit path doesn't exist on the build server.
I will post back with more information once I've found some documentation on PCL and these Facades.
Update
Yeah pretty much nothing on facade assemblies on the whole internet.
Google:
(Facades OR Facade) Portable Library site:microsoft.com
The only way that worked for me - add the assembly to web.config
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
#PeterMajeed's comment in the accepted answer helped me out with a related problem. I am not using the portable library, but have the same build error on a fresh Windows Server 2012 install, where I'm running TeamCity.
Installing the Microsoft .NET Framework 4.5.1 Developer Pack took care of the issue (after having separately installed the MS Build Tools).
I had this problem in some solutions on VS 2015 (not MVC though), and even in the same solution on one workstation but not on another. The errors started appeared after changing .NET version to 4.6 and referencing PCL.
The solution is simple: Close the solution and delete the hidden .vs folder in the same folder as the solution.
Adding the missing references as suggested in other answers also solves the problem, but the error remains solved even after you remove the references again.
As for TeamCity, I cannot say since my configuration never had a problem. But make sure that you reset the working catalog as a part of your debugging effort.
It's an old issue but I faced it today in order to fix a build pipeline on our continuous integration server. Adding
<Reference Include="System.Runtime" />
to my .csproj file solved the problem for me.
A bit of context: the interested project is a full .NET Framework 4.6.1 project, without build problem on the development machines.
The problem appears only on the build server, which we can't control, may be due to a different SDK version or something similar.
Adding the proposed <Reference solved the build error, at the price of a missing reference warning (yellow triangle on the added entry in the references tree) in Visual Studio.
I was also facing this problem trying to run an ASP .NET MVC project after a minor update to our codebase, even though it compiled without errors:
Compiler Error Message: CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Our project had never run into this problem, so I was skeptical about changing configuration files before finding out the root cause. From the error logs I was able to locate this detailed compiler output which pointed out to what was really happening:
warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll'
c:\Users\Admin\Software Development\source-control\Binaries\Publish\WebApp\Views\Account\Index.cshtml(35,20): error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\meseems.webapp\68e2ea0f\8c5ee951\assembly\dl3\52ad4dac\84698469_3bb3d401\System.Collections.Immutable.DLL: (Location of symbol related to previous error)
Apparently a new package added to our project was referencing an older version of the .NET Framework, causing the "definition in multiple assemblies" issue (CS1685), which led to the razor view compiler error at runtime.
I removed the incompatible package (System.Collections.Immutable.dll) and the problem stopped occurring. However, if the package cannot be removed in your project you will need to try Baahubali's answer.
Install the .NET Runtime as well as the targeting pack for the .NET version you're targeting.
The developer pack is just these two things bundled together but as of today doesn't seem to have a 4.6 version so you'll have to install the two items separately.
Downloads can be found here: http://blogs.msdn.com/b/dotnet/p/dotnet_sdks.aspx#
On our Tfs 2013 build server I had the same error, in a test project.
with the main web project running on .Net 4.5.1.
I installed a nuGet package of System Runtime and added the reference from
packages\System.Runtime.4.3.0\ref\net462\System.Runtime.dll
That solved it for me.
I needed to download and install the Windows 8.0 (and not 8.1) SDK to make the error disappear on my TeamCity server.
https://developer.microsoft.com/en-us/windows/downloads/windows-8-sdk
i added System.Runtime.dll to bin project and it worked :)
I had this problem in a solution with a Web API project and several library projects. One of the library projects was borking on build, with errors that said the Unity attributes weren't "valid" attributes, and then one error said I needed to reference System.Runtime.
After much searching, reinstalling the 4.5.2 Developer Pack, and nothing working, I figured maybe it was just a version mismatch. So I looked at the properties of every project, and one of the very base libraries was targeting 4.5 while every other one was targeting 4.5.2. I changed that one to also target 4.5.2 and the errors went away.
I copy the file "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Facades\system.runtime.dll" to bin folder of production server, this solve the problem.
For me I am using Microsoft visual studio 2019 and Windows server 2019 .
This web.config compilation part
<compilation debug="true" targetFramework="4.7.2">
Suddenly this error appeared during development and coding
I tried adding the assembly and reference its not solved the issue
This error solved after close and open visual studio and open project again .
install https://www.microsoft.com/en-us/download/details.aspx?id=49978 Microsoft .NET Framework 4.6.1 Developer Pack and add this line of code in Web.config file
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>
</compilation>
For me helped only this code line:
Assembly.Load("System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
Deleting the bin folder and rebuilding the solution worked for me.
In my case the .csproj file somehow was mixed up. Some 'Compile' elements were missing a 'SubType'.
<Compile Include="Control.cs" />
Fixed the issue by adding the "SubType" again:
<Compile Include="Control.cs">
<SubType>UserControl</SubType>
</Compile>
Removing the reference over the Nuget Package Manager and re-adding it solved the problem for me.

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!

Could not load file or assembly 'Microsoft.ReportViewer.WebForms'

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)

Error with <add assembly="System.Data.SqlClient, Version=10.50.1600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Why do I get this error? How I can fix it? I'm connecting from Web.config in an application that I started to do but I finish school issues because it is a team effort. The teacher has told me I should put that online so that my connection is well made ​​but not if publicToken or something else this evil at the time of writing the line is enclosed in asterisks. I need to indicate that I am writing wrong Please will thank you.
Server Error in '/' Application.
Configuration Error
Description: Error during processing of a configuration file required to service this request. Check the specific error details below and modify your configuration file accordingly.
Parser Error Message: Could not load file or assembly 'System.Data.SqlClient, Version = 10.50.1600, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'or one of its dependencies. The system can not find the file specified.
Source Error:
Line 51: <add assembly="System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 52: <add assembly="System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 53: **<add assembly="System.Data.SqlClient, Version=10.50.1600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>**
In .NET there is no such assembly as System.Data.SqlClient, Version=10.50.1600, .... SqlClient is the part of standart .NET Framework distribution.
For example, System.Data.SqlClient.SqlConnection:
Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
How to determine fully qualified assembly name
Download the previous, free version of .NET Reflector, load assembly into (simply drag it onto) and you will see it's FQN
Have you checked to make sure that the dll indicated is being deployed and that the version number matches the version you specify above? The error is pretty clear. The system can't find the assembly that the code refers to on this line.
Well, you can browse the GAC (Global Assembly Cache) for meet the assembly data. Use the following command from de command prompt :
gacutil -l
This list the content of the GAC with the information that you need.

Resources