Published WPF application exception - c#

I can run my published WPF application file locally fine, however if I install to another machine I get a Windows report error dialog. The only useful error info I see is System.Windows.Markup.XamlParseException.
I've included all the necessary assembly used in the project, plus the 3rd party assemblies (syncfusion) also included in the GAC of that machine.
Is there anything I'm missing?
 

The reported xaml parse exception in the machines other than the local machine may due to the resource files not being included along with the deployed files while publishing the application. So please ensure that the necessary resource files needed for the application are marked as “Include” in the Publish Status like in the below screenshot.
Screenshot
Please check and let us know if it is helpful.
Regards,
Gokul S

I had a similar issues in published WPF .NET Core 3.1 VS 2019.
To me the solution was disabling Trim unused assemblies (in preview):

Related

Server Error in '/' Application after updating a dll in a C# .NET website project

We have a C# .NET website which was developed and maintained by a third party. I'm due to take over the general upkeep soon, so am trying to get a system going where I can maintain a local copy and deploy updates to the website. We need to make it work for two of us to work on for at least another month, after that I'm on my own.
We have an SVN of source, and an SVN of production published code. I can pull the solution and after some faffing I can make it build and run without problems locally. I'm using Visual Studio 2015, the target framework is 4.0.
I can update cshtml files, build, publish locally, and then copy these files over the website published version and it runs fine.
However, the bin/dlls that are produced, if copied into the website version, produces this fabulous error:
http://website.com/Error/InternalServerError?aspxerrorpath=/
Server Error in '/' Application. Runtime Error.
Description: An exception occurred while processing your request.
Additionally, another exception occurred while executing the custom error page for the first exception.
The request has been terminated.
If I copy back the dlls from the original, it works fine.
If I don't modify the code, but just build and publish the project, my dlls are still different sizes from the website versions.
The developers are using Visual Studio 2012, is this a factor? Why are the dlls for my local version (that runs fine) different, if I download the source and build/publish it with no changes?
The dlls in question by the way are a single one for the website itself, website.dll say, and one for 'objects' that they've dumped a load of functions into for doing various things, objects.dll, these are the only two I'm trying to copy over - all the other dlls match in size between my and the website versions.
I'm pretty new to this so may be making some fundamental mistakes here, but if I am, then our developer isn't picking up on them. I mean, I'm kind of not surprised that they're different, surely you need to deploy the whole project, and not just drop some dlls into an existing published folder? My developer is saying that's the only way we can do it...
Any tips of things I can try?
Thanks in advance.
Well, after a LOT of trial and error, I finally found a solution that works for me, for the moment:
Using nuget package manager, I reverted to Microsoft.AspNet.Mvc version 4.0.40804 for the project in question. This seems to have updated all the references and runtimes back to the 4.0.0.0 that the project was built using.
When I build, publish, and copy across the main dlls, the site now runs, rather than showing the 'Server Error in '/' Application. Runtime Error'
One thing, are there security implications for running such an old version? Maybe that needs to be a new question...
Thanks for all the help.

Could not load file or assembly 'EfTidyNet' or one of its dependencies

I am trying to host an application on IIS 7.0, this application is using a third party dll
EFTidynet.dll for removing unwanted html code in the application. when i am running this application using Visual Studio 2010, its working fine, but when i hosted this application on IIS 7.0 its giving the error of
Could not load file or assembly 'EfTidyNet' or one of its dependencies.
I have already added the name in the assemblies section on web.config but still no success.
Can anybody help me out.
EfTidyNet (on codeproject.com) seems to contain only one DLL. The directions say that it needs to be registered in the GAC.
I usually create a folder in my c:\inetpub\ folder named "Bin" or "DLL" or "GAC". It makes it much easier to find registered files (that I'm using for IIS). Microsoft has plenty of good instructions on GACing a file. http://msdn.microsoft.com/en-us/library/dkkx7f79(v=vs.110).aspx
On my development machine, I was having the same error message, followed by:
An attempt was made to load a program with an incorrect format.
Apparently, EfTidyNet is a 32-bit DLL, which didn't work too well on my 64-bit version of Windows 8.
The error disappeared after I enabled 32-bit applications in the advanced settings of the application pool of the web site, as explained here:
Could not load file or assembly exception

BadImageFormatException: Could not load file or assembly ... bad format - Only with Web Application

I am working on a Web Application on a Windows 8 64 bit machine using multiple existing libraries. I want to use two C# DLLs referencing one native DLL. Both C# DLLs are compiled for 64bit usage and tested in test applications.
My web application references both C# DLLs and is supposed to run on IIS 8.
I added the two C# DLLs as references to the project and the native DLL manually to the bin folder of the web app. Whenever I build and run the solution I get the exception shown in the title.
I know that this is a sign for a problem regarding 32 bit and 64 bit code running in one process. Therefore I tried all different build configurations but the result never changed.
I created a console application doing exactly what I'm trying in the web app and it worked flawlessly.
The Web application with the exact same settings however throws the exception, this is what is really confusing to me.
What I tried so far:
Change application pool setting to "enable 32-bit applications"
Build all DLLs with Any CPU, 64Bit or x86 target
Check the corflags of all DLLs
I can provide an export of the project to everybody willing to help me get this configuration running!
I really appreciate every bit of help!
I presume you tried with setting Target Platform (Build option in project properties)?
Also, take a look at this article:
http://www.codeproject.com/Articles/383138/BadImageFormatException-x86-i-x64
I got the same issue on my application. It was fixed after I perform the following:
* Granting permission for the "Anonymous" user in my web site folder.
* Changing the application pool from ".NET v4.5 Classic" to ".NET v4.5".
All I can offer is some help in determining what isn't loading. If it's a dev server it might be worthwhile to install the appropriate sdk to use the Fusion Log Viewer. If that isn't an option you can turn on assembly binding logging from the registry as follows:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion]
"LogFailures"=dword:00000001
"LogPath"="c:\\bindFailureLogs\\"
just be sure to turn it off when you're done, there is a performance penalty using the assembly bind logging. Make sure the folder exists before you enter the registry key and recycle the application pool of the application for the logging to start. This will provide you a detailed list of what dll (or dependency since it's not always readily apparent if it's a dependancy or the dll listed in the error message) didn't load and where it tried to load it from.
Your partitioning of the applications fixing the problem suggests that there are multiple dependencies on the assembly targeting different versions and since only a single version of an assembly can be loaded into an app domain some dependency isn't being satisfied. For managed assemblies you could use an assembly binding redirect, but I don't know what the unmanaged equivalent of that would be if it even exists.

Application works in VS, but fails once published

I have an application that runs perfectly when I run it from Visual Studio. But once I hit "Publish" and try to launch "setup.exe", I get an error message:
This application could not be started. Do you want to view information about this issue?
Clicking on yes leads me here. I have no idea what "SHIM" is and it's definitely not part of the code.
The error is the same if I publish to a network share or to my local drive. Once installed, the application shows up in "Programs and Features" and can be uninstalled but a Start Menu entry is not added. It's as if the error occurs during the installation.
I tried chancing the prerequisites (and target framework) between 3.5 and 4, as well as Windows Installer 3.1 vs 4.5 - no dice.
While it is currently targetting 3.5, it was originally created as a 4.03 app. I did change the target framework a couple times and going back to 4.03 doesn't fix it. I'm pretty sure this issue appeared as a result of retargetting.
Can anyone provide clues where to look?
Take a Look at configuration files if you have any app.config or web.config.
If you didn't find any tag regarding the target framework, Do a File Search on you solution folder and if you find something in .csproj or .sln files, change it to the correct one.

Deploy a program that includes Microsoft.Smartdevice.Connectivity assembly

I am using Microsoft.Smartdevice.Connectivity assembly as a part of a larger application. Now I have to deploy that application and I can't find any info in regarding to deploying such applications. Even on the msdn resource page there is a question regarding this issue, with no replys.
So how can I deploy such an application. Is there a list of assemblys I have to deploy or something?
I have included the Misrosoft.Smartdevice.Connectivity.dll however the application is still missing at least one file: "Microsoft.VisualStudio.Connectivity.Interop.dll" I can't find that file anywhere. How can I deploy this application on a machine without visual studio installed.
How can I deploy the application on a computer without visual studio? Is there a SmartDevice Connectivity API redistributable or something?
Thank you for your help.
There is a tool called IsoStoreSpy.application. You can use it to deploy applications.
Good luck
This is a very old question but these libraries are in the NuGet package managerment framework which should allow you to include references. Set the project's build to copy all package-managed DLLs into the output directory of your executable.
http://www.nuget.org/packages/Smartdevice.Connectivity/

Categories