C# Windows Form Project Loading Blank On Other Machines - c#

I searched around but I could not find anything on this.
I have programmed a c# application in VS 2010, targeted to .NET Framework 4.0. It has a .DLL and a few config files which I have being copied to the output directory upon compilation. It works great on my computer, I have .NET 4.0 Extended and .NET 4.0 Client installed. I set the build configuration to "release" on "any CPU".
After it compiles I copy all the files from the release directory to a folder on a shared drive, so that multiple computers on the network can execute it. When I execute it from the computer that I used to develop it, it runs great. When others try to execute it starts but just shows a small blank form, and that's it. I make sure that they have .NET 4.0 installed (Both Extended and Client, though I think the full version is what is really required).
I can't for the life of me figure out why it does this.
All machines are running 32 Bit Windows Vista SP2.
Any thoughts? Much appreciation for any help.

It can be a lot of things. First, like one comment, you should do a quick Deployment project and try to install on another computer to see how it work.
If you can't do that, here a couple of things to check:
It can be a network permission problem. I've seens an .NET application that could not be executed on the network for x reason but worked on the desktop. To check, make sur your user copy it on their computer before executing.
I don't think it's a .NET problem because it wouldn't let you start the application.
My guess is that one of your control/library (the one that is not showing) does not have the proper reference when run from another computer. To check, run the application "Dependency Walker" (you can find it on google) and see what DLL are missing from other computers.
That's all I can think for now ! Good luck! You just have to use ellimination method and you will find the problem.

Related

monodevelop - working debug but not working release

I have developed a project with VS on Windows 10. Right now on Linux mint i am debugging the project with MonoDevelop and it runs just fine.
Let me show you:
However when i make a build and i go to the Release folder and then i try from the terminal to launch the program i have a problem. Let me show you first the files i have build:
Then i go to the directory with my terminal and i run:
chmod +x ./WorldServer.exe then i run ./WorldServer.exe
and i receive the following error:
I know that this is .exe file and maybe i have to build a different type of file. But i am not really sure what setting should i apply in my project to make a working build for linux.
As far as i know linux is using .so as extension for it's libraries. However it is generating .dll files. Can i change that? Can i somehow make my project to be "buildable" in the two OS Linux and Windows ?
The exception tells us, you need System.Management in your project. It isn't there.
Why?
Because Mono, according to there Road-map, doesn't support this:
The following do not map to operating systems other than Windows, and
we are unlikely to spend time to support them even on Windows:
System.Management
How?
System.Management is a library that only works on Windows. The MySQL connector driver has started to depend on this library and tries to load it per reflection.
I'm not into this whole MySql Progess but there is an open bug for it. Also there is a comment which says:
The last working version of the MySQL .NET Driver is 6.4.6
I hope this helps you.

WPF application doesn't run on another computer

I created a new WPF project. I copied the built .exe file onto another computer and tried to run the application. But nothing happened. It was just loading. Nothing more.
All my WPF projects do this thing.
What am I doing wrong? Has anyone any idea?
Edit: For somebody in the future: the question might not be clear. What I meant was that I created a simple WPF application with nothing in it and tried to run the application on another computer. I wasn't able to make it run. Just nothing appeared. I figured out that the Avast Free Antivirus was causing this problem. When the antivirus is turned off, it runs as expected. Even though it is no solution, at least we know, what was causing the problem.
You are probably missing the dot net libraries on the target machine.
For quick fix, download the dot net framework distributable for the .net version you compiled against and install it on the target machine. Here is 4.5.1 for example.
For actual distribution, look at creating an installer that will ensure all dependencies are installed with the application. InstallShield has a limited edition which may be included with your edition of visual studio
Try publishing your application using click once. You can do this by right clicking on your project > Publish > Specify the location to publish your application > Finish. Copy the files inside the Published folder to another computer and try installing by click the setup.
Note: The instructions I said above only works if you only have basic functions on your app. If your application uses SQL Server, you need to install it first on the computer that you will be installing your application in.
For your reference. How to: Publish a ClickOnce Application using the Publish Wizard

C# Application Executable will not run on any other device

I have devoloped a C# Application to search a certain directory, read in any files containing a certain string, and then compare those to a database and do various things with said information. I need to upload the project\exectuable to another machine where it will contantly run on a timer, however Every time I try to open the exectuable on any other device I get the windows error, the GradeUpdate (my project name) has stopped working. I created the project in Visual Studio 2013, and only have a few references out of the ordinary which are as follow, and I made sure these references are in my release folder that I copy over to the device which I need the program to run on.
MySqlData.dll
MySqlWeb.dll
I recreated the project from scratch thinking it may be a naming issue, but this did not make a difference. In addition a C# application written in Studio 2010 works on the machine that I am trying to access, however the 2013 application I wrote does not. I believe there may be some local file not included in the project folder that it access's on my local computer, but that is my best guess, any and all suggestions would be very welcome!
Could it be that the machine doesn't have the version of the .NET runtime you're targeting? If you're using Visual Studio 2013, your app may be targeting .NET 4.5. Can you make sure the target machine has the .NET 4.5 runtime installed?
the infamous works on the machine this is a common mistake that beginners make when learning to code.. just because it works on your machine will not guarantee that it will work on others I would first look at the properties of the .dll / assemblies and make sure that you have the CopyLocal property for the dll's set to true make sure that not only are you adding the assemblies in the using header section, but manually adding them to the reference node.. also make sure that the target machine has the same .net framework installed on their machine.

Can I make an application made as a C# Windows Application developed in Visual Studio 2012 as a portable application?

I have made a Windows Form Application in C# using Visual Studio 2012. Can I publish this as a portable application to windows machines ?
P.S. portability here I am referring is working with any Windows( preferably windows 7 or 8 ) machine without installation and .net framework
Yup.
All you need to do is sheep your bin folder. It has your executable and all dependencies.
No installation will be required.
Just bear in mind that in order to be really portable, you will need to make sure that your application does not modify registries or computer configurations.
(from wikipedia:)
A portable application (portable app), sometimes also called
standalone, is a program designed to run on a compatible computer
without being installed in a way that modifies the computer's
configuration information.
You can if you do not have any dependencies, e.g. you have only the .EXE. If you have some .dlls you can use ILMerge to merge them into one .EXE
Depends on what you understand under portable. Avi's answer certainly works, as does ILMerge, but there's also the one file, no installation needed approach to portability.
I tread carefully because I don't want to advertise any application or another, but apart from taking the entire /bin folder, I've played around with Cameyo in the past and that seems to do a pretty decent job at virtualizing (and rendering portable) most applications as long as they aren't too large (or maybe have too many dependencies on what have you, not sure). Alternative tools may exist, I haven't researched any of them recently and neither do I prefer or affiliate myself with any of them.
Seems to work fine for your average app. I've tried to virtualize Visual Studio, that was fun. Big no-no. Who knows, it might suit your needs. It still doesn't take away the need for a .NET framework installed on the target machine though. As I mention in comment, that might be something for .NET Native (and, at time of writing, the future).

Is there a .Net 4 or 3.5 redistributable that is not in installer form? A DLL placed in the programs folder?

I'm working on a program in Visual C# 2010 for a friends company and it does not have any .NET installed. I know you can download .NET 3.5 or 4 from Microsofts site, but the accounts that the program will run on will not be able to install anything. Is there a DLL I can download and then place in the programs folder to make it work? Or any other alternative that does not include installing things or downloading things.
Edit: Disregard the 5mb limit: I had mean that if I have to download any program on the computer the program will be executed on, it should be below 5mb. The final application can be double or triple the original programs size.
Thanks,
Varmitharen
Let me answer this directly so that you don't waste neither your time nor your friends: No there isn't other way other than properly installing .NET (or rewriting your application with unmanaged C++ code which is unlikely something you are willing to do). Not to mention that most Windows PC should already have at least .NET 3.5 installed through Windows Update.
The .NET 4.0 Client Profile is 41MB and that's the minimum you get away with.
While there are some options for running .NET applications without installing the framework properly (e.g. VMware ThinApp), I very much doubt that you'll find anything that fits in 5MB...
Heck, just mscorlib from .NET 4 is 5MB, then System.dll is nearly 3.5MB.
If your application can run on top of Mono, you can try using mkbundle, normally the resulting exe file is relatively compact.
Xenocode (now called Spoon Studio, I believe) allows you to deploy a single executable without previously installing the Framework.
It uses some kind of virtualization to achieve this. I don't believe it would fit in just 5 megs - but I might be wrong.
If the framework has not been installed, there will be no interpreter/jitter and .NET programs will not run.
You need to install the framework in order for .NET software to run.

Categories