I made a c# program with VS 2019 with crystal report for visual studio. All works well in my machine.
I'm installing in my client with Clickonce. But I having a problem in my client with this error:
System.TypeInitializationException: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. --->
System.TypeInitializationException: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception. ---> System.IO.FileLoadException:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at CrystalDecisions.Shared.SharedUtils..cctor()
--- End of inner exception stack trace ---
at CrystalDecisions.Shared.SharedUtils.get_CurrentControl()
at CrystalDecisions.Shared.SharedUtils.GetEffectiveCulture()
at CrystalDecisions.CrystalReports.Engine.CREngineRes.GetString(String name)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.CheckForCrystalReportsRuntime()
at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()
--- End of inner exception stack trace ---
at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()
at PatientTrackingSystem.MainWindow.<PrintReportAsync>d__143.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PatientTrackingSystem.MainWindow.<cmdPrintRouteSlip_Click>d__144.MoveNext()
For the file log4net, I changed the publish Status in the Application Files to "Include" but I still have the same error.
Then I installed the log4net NuGet Package in my application, remade the clickonce setup, and I still have the same error.
When I look in the my client machine, I see that file where clickonce install the application.
Any idea to fix that issue?
You are facing issue while loading the file which used to append your logs, please mention the steps you have followed and make sure your config file and assembly file is correct, most of the issue is due to your config file .
You have to go to AssemblyInfo.cs and include
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
You have to make sure in your config file file path under this tag is correct :
Related
Weird issue I've faced today.
Pre-requisites:
Installed:
VS2019
.NET Core 3.0
Steps to reproduce the issue:
Create new "WPF App (.NET Core)"
To the MainWindow.xaml add single TextBlock:
<TextBlock Text="WPF on Linux" TextWrapping="Wrap"/>
Create new Publish Profile like the following:
Then save and publish
Expected to see the application being published. But instead the following message pops up:
And here is the content of the mentioned in the error message file:
2019-10-28 19:39:43
System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__202.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---
System.Exception: Publishing failed.
===================
The question is.. What am I doing wrong and/or how to fix the issue?
Important note:
If Deployment Mode is set to "Framework Dependent", and the Target Runtime is "linux-x64" then the project is published into the directory with no issues.
If Deployment Mode is set to "Self-contained", but Target Runtime is "win-x64", then deployment works with no issues.
The error is in the build output window:
There was no runtime pack for Microsoft.WindowsDesktop.App.WPF available for the specified RuntimeIdentifier 'linux-x64'
WPF is not supported on Linux, only Windows.
From VS 2017
what I tried:
Build in release mode & debug mode both builds fine.
Set Build verbosity to Diagnostic, there is not much information
indicating code error.
However .tmp dump file indicates some error.
I suspect these are visual studio internal errors:
5/4/2018 9:34:44 PM
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish failed due to build errors. Check the error list for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__88.MoveNext()
---> (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<---
===================
Setting RazorCompileOnBuild property to true should resolve your problem.
Take a look on following question
Had to set build verbosity to diagnostics then found out there were some errors in un-used Razor view pages.
There must be a way to compile Razor during build time rather than when publishing.
I am trying to deploy a .NET Core 2.0 application to IIS. This is just the standard .NET Core web application that is created when starting a new project. The project builds and run just fine. However, when trying to publish to IIS via web deploy, I get the following error:
3/25/2018 3:45:08 PM
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish failed due to build errors. Check the error list for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__88.MoveNext()
---> (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<---
===================
Am I missing something?
I'm trying to use project.json to make managing packages easier in a Service Fabric project.
However it is failing and I think it is due to not including ServiceFabricServiceModel.dll in the services. I can see the dll in the nuget packages in C:\Users\nick.nuget\packages\Microsoft.ServiceFabric.Actors\2.0.135\lib\net45, but the nuspec file does not reference it.
There are quite a few errors when trying to deploy.
For example
Exception thrown during async task execution
System.IO.FileNotFoundException: Could not load file or assembly 'ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Microsoft.ServiceFabric.Services.Common.FabricServiceConfigSection.Initialize()
at Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportServiceRemotingProviderAttribute.CreateServiceRemotingListener(ServiceContext serviceContext, IService service)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<OpenCommunicationListenersAsync>d__1b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<System.Fabric.IStatefulServiceReplica.ChangeRoleAsync>d__5.MoveNext()
=== Pre-bind state information ===
LOG: DisplayName = ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/SfDevCluster/Data/_App/_Node_1/SceneSkopePlatformType_App0/ServiceRegistrationServicePkg.Code.1.1.13 (2016-04-05 16.10.16Z)/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.ServiceFabric.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\SfDevCluster\Data\_App\_Node_1\SceneSkopePlatformType_App0\ServiceRegistrationServicePkg.Code.1.1.13 (2016-04-05 16.10.16Z)\ServiceRegistrationService.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
This is a breaking change how dotnet cli handles not listed assemblies in nuget packages. For "old style" projects VS2015 copies this assembly to the project output, but the dotnet cli does not.
Until it's fixed, you can either wrap the assembly or copy it to the output in a postpublish step.
The assembly is downloaded to:
%userprofile%.nuget\packages\Microsoft.ServiceFabric.Services\2.0.135\lib\net45
MSFT solved this in the latest nuget package version 2.1.150
Using the Azure SDK installer 2.4 failed to install the azure storage emulator with the following error on the log:
CAQuietExec: Windows Azure Storage Emulator 3.3.0.0 command line tool
CAQuietExec:
CAQuietExec: Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.Storage.Emulator.Controller.Configuration.StorageEmulatorConfigCache' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized attribute 'enable'. Note that attribute names are case-sensitive. (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config line 104)
CAQuietExec: at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
CAQuietExec: at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
CAQuietExec: at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
CAQuietExec: --- End of inner exception stack trace ---
CAQuietExec: at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
CAQuietExec: at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
CAQuietExec: at Microsoft.WindowsAzure.Storage.Emulator.Controller.Configuration.StorageEmulatorUpdatableConfiguration.GetConfigurationSection(String name)
CAQuietExec: at Microsoft.WindowsAzure.Storage.Emulator.Controller.Configuration.StorageEmulatorConfigCache..cctor()
CAQuietExec: --- End of inner exception stack trace ---
CAQuietExec: at Microsoft.WindowsAzure.Storage.Emulator.Controller.Configuration.StorageEmulatorConfigCache.get_Configuration()
CAQuietExec: at Microsoft.WindowsAzure.Storage.Emulator.Controller.Initialization..ctor(Boolean forceCreate, Boolean autodetect, String server, String sqlInstance)
CAQuietExec: at Microsoft.WindowsAzure.Storage.Emulator.InitCommand.RunCommand()
CAQuietExec: at Microsoft.WindowsAzure.Storage.Emulator.Program.Main(String args)
CAQuietExec: Error 0xe0434352: Command line returned an error.
CAQuietExec: Error 0xe0434352: CAQuietExec Failed
Looking at the machine.config line found the 'enable' attribute but I am not sure why this would be a problem.
Here is the machine.config line
<section name="processModel" type="System.Web.Configuration.ProcessModelSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineOnly" allowLocation="false" enable="true" requestQueueLimit="15000"/>
Any help would be greatly appreciated.
I had the same issue , the following is how i fixed the issue.
Uninstall old Windows Azure Storage emulator , via add/remove programs. In case if you are not able uninstall then use FixItnow to uninstall http://support.microsoft.com/mats/program_install_and_uninstall/en
2.Once the old emulator is gone , you should be able to install the new storage emulator.
Give it a try and let me know.
Thanks
On the previous post there was a posted machine.config that gave me the answer to this question.
After looking and comparing your Machine.config from a successful install I found that the one that worked did not have the "enable" attribute nor the "requestQueueLimit" defined.
I removed those 2 attributes while installing and it worked. I am not sure how the installer works but it apparently does not have all the definitions for all the "processModel" element in the machine.config.
I hope there is someone out there that knows why this would be an issue and why this fix works.