unable to add a rdlc report to asp.net web applicatioin - c#

I am adding the RDLC (report wizard) to my asp.net web application. I am using visual studio 2010 and have installed the AJAX control tool-kit using Nuget package manager.
Problem is arising at the point when I am adding a new item and then opting a new item as rdlc. then as I click over rdlc, instead of adding an rdlc to my project I am getting following error.
"could not load file or assembly 'AjaxControlToolkit' version=4.1.7.1213, Culture=neutral.... or one of its dependency."
I am unable to understand why i m getting this error. Kindly suggest some ways to add the rdlc smoothly.
Thanks!!

Try copying the AJAXCONTROLTOOLKIT.DLL file to the following folder.
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies
Hope this works.
It worked for me.
May be you get this problem again while adding Report Data also, if you are referencing to another business/ data layer project in the solution. Then also copy the dll of those projects to same folder as mentioned above.

Related

C# .NET "Could not load file or assembly System.Runtime"

I built a small C# web API using ASP.NET, mostly following this YouTube video. The project runs perfectly fine on Visual Studio Code. However, when I try to open the same folder with Visual Studio and run program.cs, I get the following error message:
Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I'm using ASP.NET Core Runtime 6.0.5, and I believe that's where the problem is (please correct me if I'm wrong). However, I don't know how to fix the issue. I tried reading this article, but I don't have App.config file for web APIs. I also tried to read .NET's known issue report, didn't really tell me what exactly should I do to fix the problem.
Any help and insights are appreciated. I'll also share any relevant code and package version information. Thanks!
Update
The problem is now fixed, although I'm not sure how exactly. Here are the steps I took:
1 - From VS code, create a new project using dotnet new webapi --framework net6.0 command line.
2 - Delete WeatherForecast.cs and WeatherForecastController.cs, if they got automatically created.
3 - Copy every C# file I wrote from the last project to this one, including program.cs.
4 - Close VS code. Open the project folder with Visual Studio and select File -> New -> Project From Existing Code -> (What type of project would you like to create?) C#.
One thing I noticed about the working project is that the project icon is different (before it was a green "C#" and wasn't working, now it looks like a blue globe representing web project, although both were C# project and had a .csproj file). Hope that helps.
Simpler solution: Just open the [project].sln file through double-click (to open it with Visual Studio ) directly.
The .sln file maintains the project state - Resource

Getting "STG_E_FILENOTFOUND" when creating project using project template wizard

I am trying to create a VSIX project for creating multi-project template using Wizard but I am getting exception on
this.dte.Solution.AddFromTemplate(Path.Combine(this.templateDirectory, "WebTemplate\\UI.vstemplate"), Path.Combine(this.solutionDirectory, this.projectName), this.projectName, false);
Exception is
"could not be found. (Exception from HRESULT: 0x80030002
(STG_E_FILENOTFOUND))"
Stack trace is:
at EnvDTE.SolutionClass.AddFromTemplate(String FileName, String
Destination, String ProjectName, Boolean Exclusive)
at TemplateWizard.RootWizard.ProjectFinishedGenerating(Project project)
I struck this trying to use a project template that I had created in VS2019, to create a project in VS2022. I got around it by opening the solution in VS2019 which is still on my machine, and adding the project there.
You can unzip the template and open the template manifest to check that all the files referenced are indeed in the template. I did this, and it wasn't the problem.
Close ALL the windows as they may prevent changes.
Visual Studio has a cache for templates. This cache can be found in the link. Please delete the cache and the initial templates that were added in the ProjectTemplate folder of the visual studio folder.
I also ran these 2 commands in the Developer Command Prompt of Visual studio (probably not necessary but I tried with everything I found on the internet).
devenv /installvstemplates
devenv /updateconfiguration
Now check if you can find the templates again. They should not be there if everything was delete and the cache is clean.
Add the template again and maybe run the commands above. Now try and find the template.

Report Definition Local Definition Error

i have a very strange problem.
i'm designing a winform app using C# and SQL. i have one reportviewer(its a local report) that is bound to a dataset that holds data of a select query.
the report viewer is working ok in both release and debug modes, i'm able to view data, able to export it without any hindrances..
So i went ahead and published my app using Install shield, along with all my other forms. and made the setup file
i installed the setup file on my PC for testing purpose. All forms are working fine except the report viewer. when i click on my generate report button, the error "An error Occurred during Local Report Processing, the report Defination for Report2.rdlc was not specified. Could not find.
C:\Users****\AppData\Local\Apps\2.0\C0AR0PT5.VRJ\DBE8ENNT.GWW\s.i...tion_61336ddcb5db67e9_0001.0005_09635aa1235e262b\Report2.rdlc "
What could be the reason, its working in VS2012 in both Debug as well as release mode.
Please help, What could be the issue?
You should embed the report as a project resource. As it seems, your application expects the report's RDLC file to be present outside the application as a file on the disk.
On your comment "How do I do that?":
Set "Build Type" for the RDLC file in Visual Studio to "Embedded Resource" and then read this. I'd like to add that you need to add the full namespace.
Example: your RDLC file is "MyReport.rdlc" and it's in the sub-folder "reports" of a project with default namespace "com.example.MyFirstProject". Then you need to set ReportEmbeddedResource to
com.example.MyFirstProject.resports.MyReport.rdlc

The report definition is not valid

I have converted an .rdlc rerort from SSRS 2005 to SSRS 2008. Now when I am going to build that project I have got error.
The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' which cannot be upgraded.
Please give me solution for this.
Just stumbled upon this question since I was having the same problem. In my case, I had a reference to an older version of ReportViewer.WinForms. When I switched versions, everything worked fine. Might not be the same case as yours, but just thought I'd chime in in case anyone else finds this page.
I faced an almost similar problem but in another version of visual studio ( 2012) and i found out that the problem was from the version of Microsoft.ReportViewer.WebForms.dll or winforms. You may be still referencing the old one related to your current version of visual studio so check the dll version and if so remove it and add the latest one
I encountered this same problem, and the solution for me was to edit the file:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0
\ReportingServices\Microsoft.ReportingServices.targets
And change line #2, which previously said this:
<UsingTask TaskName="Microsoft.Reporting.RdlCompile"
AssemblyName="Microsoft.ReportViewer.Common, Version=9.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
To this:
<UsingTask TaskName="Microsoft.Reporting.RdlCompile"
AssemblyName="Microsoft.ReportViewer.WebForms, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Once that was done, my program started compiling again.
I had exacty the same problem.
For me the solution was to exclude the report from the project and to add it again. After that it compiled successfully.
I'm not entirely sure why #user2702793's answer got down voted, because that suggestion just saved my career:
Consider
Creating a blank SSRS 2008 report and copying all the content out of the SSRS 2005 report into the new one
copy the name of the SSRS 2005 report if you want to keep the name of the report intact
delete that report (SSRS 2005 one you just copied the content from into your new report)
rename your new SSRS 2008 (with the deleted SSRS 2005 report's content in it) and paste the report name in.
I had a very similar situation mentioned above except I wanted to retain my SSRS old versions instead of upgrading it. Which basically had me making a copy of the old version, copying the content out of the accidentally upgraded report and pasting it into the copied report, and copying the name of the upgraded report, deleting it and renaming my copied report to retain the same name of the report that just got deleted.
Edit: Of course in my case I also wanted changes done to the old report which was all in the upgraded report hence my lengthy work around to keep from losing my current changes.
The solution that worked for me was to run the .NET cleanup tool, I tried the .NET framework repair tool first and it did not work. I read the suggestions here
In ReportViewer properties in webform expand LocalReport/Path in the field put the correct path of report
This works for me...
It might be a conversion problem. Recreate a new 2008 report.
And I suggest using VS2010. I have the same problem when editing a report with VS2012.

ImageResizer library: plugins fail to load unless the project is rebuilt

I'm using the ImageResizer library (version 3.2.4) in a ASP.NET MVC 4 project, with the following plug-ins: Watermark, MvcRoutingShim, DiskCache and SimpleFilters.
Everything works fine when I launch the project in Visual Studio 2012 for the first time.
But after stopping and restarting the project for 2 or 3 times, the plugins fail to load, which is confirmed in the diagnostic page:
(...)
Plugins(ConfigurationError): Failed to load plugin by name "Watermark"
Verify the plugin DLL is located in /bin, and that the name is spelled correctly.
Plugins(ConfigurationError): Failed to load plugin by name "MvcRoutingShim"
Verify the plugin DLL is located in /bin, and that the name is spelled correctly.
(...) etc.
The DLLs files are present in the \bin folder.
I can fix the problem by executing the project's "Clean" action in Visual Studio, and then "Rebuild".
But why are the plugins failing to load after some time?
It's likely that VS is being lazy about building dependencies that aren't referenced in code.
Try referencing the DLLs from code instead of just from Web.config, it may help.
Drop the following code into Application_Start:
new WatermarkPlugin().Install(Config.Current);
See if Watermark still shows up on the diagnostics page as missing.

Categories

Resources