I have a shiny WPF (4.0) app that I need to add Crystal Reports to. I downloaded and installed CR for VS2010, then after that we purchased and installed Crystal Reports 13 (which has the WPF CrystalReportsViewer).
As a test, I created a new "Crystal Reports WPF Application" project in Visual Studio. I created a report, linked it to my DB (Sql Server), and previewed the report. All was well.
I then copied the CrystalReportsViewer window into my "real" app (same machine and framework), added the same references and tried to run the same code:
ReportDocument _report;
this._report = new ReportDocument();
this._report.Load(#"CrystalReport1.rpt");
this.reportViewer.ViewerCore.ReportSource = _report;
However in my "real" application it bombs out on the second line with the error:
Retrieving the COM class factory for component with CLSID
{4DB2E2BB-78E6-4AEA-BEFB-FDAAB610FD1B} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I've double and triple checked that the references are the same in both projects.
I've gone through all obscure project and solution properties.
I've added a new Crystal Report to the project so it would add the references that way instead of manually.
Google says "make sure the framework is Framework 4 not Framework 4 Client Profile". Google also says "make sure the framework is Framework 4 Client Profile not Framework 4". I've tried both to no avail.
The product is registered.
What else can I do? I don't want to add my entire project to the test app!
I've been using Crystal Reports since about version 3, and not once in ANY of those versions has it cleanly installed, registered, built reports, added them to an app and deployed. You'd think that after 13 versions they'd either be able to get it right, or my various employers would choose another reporting tool!
Got it. One solution needed to be changed from "Any CPU" to "x86" in Configuration.
Installing the standalone x64 and x86 packages solved this error for me.
Related
I am trying to build MSIX setup for my WinForms application built on .net6. I want to give auto-update feature when the user clicks the "Update" button. I think originally developer didn't have control over updating MSIX and there was only way it was updated automatically when the application is restarted.
But there is a recent article on taking full control over MSIX updates I tried to follow it but I am facing the exception 'System.InvalidOperationException' while running the below line of code.
Package package = Package.Current;
I am using visual studio 2022 & WinForms application running on .net 6. I have kept other configurations as described in the above article but it is not working as expected. (I have tried in .net core 3.1 and it is working with it)
Package.Current only works in a packaged context, so you need to make sure to actually debug/launch the packaging project. An InvalidOperationException indicates that you are running your project unpackaged.
Make sure to select "Set as Startup Project" on the packaging project, likely named "MyApp (Packaging)" in the Solution Explorer. Then you can launch/debug your project as you normally do.
I'm trying to create a setup project for a WPF application (.NET 5) using VS Community 2019. I've installed the extension for the setup project and I'm following this guide. Since I want to deploy in a self-contained manner I've created a publishing profile and used its relative path for the Publish Items => PublishProfilePath entry in the setup project. However when I try to build I get the following error:
"Could not find the publishing profile ... used in project output group 'Publish Items from ... (Active)"
So is it at all possible to build a self-contained setup project? Also it's confusing that VS says that the "PublishProfilePath" is only used for .NET Core 3 projects whereas the guide mentioned above seems to indicate that it can be used for .NET Core 3 and above.
Any suggestions on this are highly appreciated.
Finally figured it out. The mistake I made was using the wrong path (the "Target location" from the publishing profile):
So the correct way to do this is as follows:
Create a publish profile which is automatically named like this:
Make the following entry in "PublishProfilePath" (don't forget to prepend "Properties\PublishProfiles"):
Then it is possible to build a self-contained installer.
I'm having issues adding a service reference to my WPF project in VS2017. The service itself is a WCF Data Service using EntityFramework (EntityFrameworkDataService). In VS2013 that I was using before, I didn't have any issues adding services to my WPF project. I upgraded to VS2017 last month, and recently made some changes to the WCF service and needed to refresh the reference in my WPF project. I couldn't seem to get it to refresh so I deleted the reference and started trying to re-add the reference and now I'm greeted with this error message:
The specified OData API cannot be added because OData APIs are now
only supported with Connected Services.
For more information, please see:
https://aka.ms/odatavsclientguidance
That provided link does not have any info regarding VS2017 setups. It recommends to use the 'OData Connected Service' extension but that extension does not support VS2017 (tried it but got a "not compatible" message). I also found the 'VS WCF Connected Service' extension for VS2017, but it doesn't appear to support WPF projects (or atleast I couldn't figure it out).
Has anyone ran into this issue with adding a WCF Data Service reference to a WPF project? Any other suggestions that I could try?
I typically generate my clients via the DataSvcUtil.exe which is part of the .net framework
e.g.
"%windir%\Microsoft.NET\Framework\v4.0.30319\DataSvcUtil.exe" /dataservicecollection /version:2.0 /language:CSharp /out:c:\temp\DataService.cs /uri:http://localhost:16584/DataService/
The MSDN docs:
https://msdn.microsoft.com/en-us/library/ee383989(v=vs.110).aspx
As TGRA so eloquently stated, the best bet for VS2017 at time of writing is to use the dataserviceutil.exe. To make things simpler for myself I do the following:
In File Explorer, navigate to the datasvcutil.exe using the path as follows:
%windir%\Microsoft.NET\{{YOUR_PROCESSOR_ARCHITECTURE}}\{{YOUR_FRAMEWORKVERSION}}
Hold shift and right-click. Select Open Commandwindow here (or command prompt if you prefer.
Now execute a datasvcutil.exe command like so for C#: datasvcutil /language:Csharp /out:{{PATH_TO_PROJECT}}/{{SERVICE_NAME}}.cs /uri:{{URL_TO_SERVICE}}.svc
OR execute a datasvcutil.exe command like so for Visual Basic: datasvcutil /language:VB /out:{{PATH_TO_PROJECT}}/{{SERVICE_NAME}}.VB /uri:{{URL_TO_SERVICE}}.svc
And voila, you're done.
I'm a newbie developer who develop a software for a company, although I am quite familiar with programming I rarely develop a software for a company, now after I join a company I started to get a problem creating a software.
I must develop a software that can be installed and updated on client computer easily, I solve this by using clickonce, then the problem arise, nearly all software I develop must have report viewer, I try using reportviewer from microsoft, but this give me more problem when installing, I try everything I found on the web to make a setup that easy to install, but I keep struggle when installing reportviewer, it keeps error on some computer although sometimes it install without error on other computer.
I need a suggestion how I can develope a program that can display a report and print it without install any other program on the client. I use C# on Visual Studio 2015, I develop WPF, and web using it.
Use nuget in your project and add the following dependencies to it
Microsoft.ReportViewer.2015.Runtime
Microsoft.ReportViewer.VS2015.WinForms
Launch your report viewer like this:
var dlg = new ReportPreviewDialog();
dlg.ReportViewer.LocalReport.DisplayName = "My report";
dlg.ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("datasource1", data));
dlg.ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("datasource2", data2));
dlg.ReportViewer.LocalReport.ReportEmbeddedResource = "YourClient.TheReport.rdlc";
dlg.ShowDialog();
TheReport.rdlc is your report as resource in your project (=> Build Action: Embedded Resource). Make sure the namespace is correct or your report won't be found.
Works with WPF.
Try to visit this Deploying Reports and ReportViewer Controls.
If the first option doesn't works you can try this step.
Go to your project properties or press (Alt + Enter).
Click the Publish tab.
On the Install Mode and Settings click Application Files button.
Find all Microsoft.ReportViewer dlls and select the Publish status to Include/Include (Auto).
Click OK.
Here is some image:
Application Files Form
Starting with the most simple case.
If I press "File->new project->silverlight business application" it opens up to MainPage.xaml saying the message attached at the bottom of this post.
It also does the same thing to any silverlight business application that exists in sourcesafe - this is the first time I've personally needed to work on this technology.
Any advice would be very much appreciated I really need to get started on a project and I feel quite disabled to not have the designer.
Thanks in advance.
An Unhandled Exception has occured
Click here to reload the designer
Details:
System.NullReferenceException Object reference not set to an instance
of an object. at
Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.d__8.MoveNext()
at
MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption()
at
MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier
identifier) at
MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope
parentScope, IParseContext context) at
MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent,
PrefixScope parentScope, IParseContext context, IMarkupSourceProvider
provider) at
MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean
convertToXamlWithErrors) at
MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem()
at
Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem()
at
Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState()
at MS.Internal.Host.PersistenceSubsystem.Load() at
MS.Internal.Host.Designer.Load() at
MS.Internal.Designer.VSDesigner.Load() at
MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load() at
MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView
view) at
MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory
factory, IsolatedView view) at
MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory
factory, IsolatedView view) at
MS.Internal.Host.Isolation.IsolatedDesigner.Load() at
MS.Internal.Designer.DesignerPane.LoadDesignerView()
If you run into this issue, a possible cause is due to you having Microsoft SilverLight version 5.0 installed on your pc versus that of 4.0 (Version: 4.0.50826.0). Remove the copy of SilverLight 5.0. Install the version located at the following link - http://go.microsoft.com/fwlink/?LinkId=146060
DO NOT INSTALL version 5.0 IF YOU HAVE SDK 3 AND 4. INSTALL MICROSOFT SILVERLIGHT 4.0
This happens if you have installed visual studio 2011 developer preview on your pc.
To resolve the error close visual studio and your browsers. Uninstall silverlight (no need to uninstall the sdk just silverlight itself).
Then re-open your project. Follow the instructions and it'll be working just fine.
it might be because of your application is developed on Silverlight 5 and you are opening it with the machine having silverlight 4. i am just giving example of 5 and 4. or might be you have not installed the SDK pack of it.