C# only run application if depenancies are installed - c#

So I finished the production of my C# application. However, it is dependent on a quite high level of .NET preferably .NET 4.6. Is there a built in way from visual studio to check if it is installed on a machine and then offer to download and install it or do I have to do path checking in my code?

Related

.NET Framework version causing different behavior between two different machines?

I'm currently trying to debug a weird issue I'm having with some RESTful API calls. I built an Angular 2 scaffold and used the publish feature to create a standalone build which users can run by opening a command prompt and typing in "project --debug" -> this will start the scaffold service and users can submit API calls to retrieve data from files. This works perfectly fine on my machine and I can make the API calls just fine, but I have another computer where the results are different. The other computer always fails and lands in an Exception block when accessing a specific type of file.
I'm wondering if this may have to do with some kind of version mismatch/difference on the .NET Frameworks and/or Microsoft Visual C++ redistributables. The published build (original computer) was built using .NET 4.5.1 while the other computer only has 4.6.1 installed.
Has anyone encountered a similar situation where the exact same build yields different results? I'm currently uninstalling versions of .NET and redistributables to test this hunch out but I'm curious if some of you may have had a similar experience.
Seems like my issue is related to the Microsoft Visual C++ 2015 Redistributables - I removed the 2015 redistributables from the original machine (because it turns on the other machine did not have them), and I received the same results. Going deeper, I'm guessing this is because one of the DLLs was built using the 2015 redistributables.

Run app built with SDK on pc without SDK

I wrote a small app built with the Microsoft Surface SDK in C# (.net 4 / 4.5), however people without the SDK seem to be unable to run the app.
I'm building it with Visual Studio 2012 and have Local Copy in the Microsoft.Surface reference set to true, but still nothing.
Is there any way that others can execute the app without installing the SDK?
There is the Microsoft Surface Runtime which you should distribute along with your application.

C# .net 4 dependency

I have a standalone tool developed in C# Visual Studio Express 2010.
My problem is that this tool will fail to start on machines having no .NET installed, and asking for .NET 4 on machines has .NET under 3.5 or lower.
What I basically want to do is to install .NET 4 from my application before the main script runs. I can write a program to download it from an official webpage, also to run the installer etc. But the main problem still exists, the app won't even reach the download part as it won't run on machines...
I've googled around and found that you can include dll-s etc., but I still doubt I can proceed without a proper .NET installation. So how can run dotnetfx.exe with my .NET dependent application?
Your attention and ideas are much appreciated.
Cs.
Use ClickOnce - it takes care of dependencies when configured correctly and comes integrated/free with VS.
EDIT: So vs express editions don't support setup projects. Plan B: wix.
simple. your installer must not be a .net application. just write your own c++ version or use some existing application. here is a link to show you how to do silent installs of .net 4. just include the setup application with your program. I would be very surprised if some of the msi installer tools out there do not have .net installation support.
http://blogs.msdn.com/b/astebner/archive/2009/04/16/9553804.aspx

C# application crashes before start

I come to you because I'm desperate. I've developed a GTK# application in C# with the latest MonoDevelop. It's built for .NET framework 4.0 / x86, and the only external library it uses is the official Mysql .Net connector. It's meant to run under Windows XP.
It's the first application I make with this IDE. I was very happy with the results and the development time, but the deployment is a real headache.
It works perfectly on the development machine. The debug is clean. Everything's okay.
Then, as I couldn't find any information about the deployment, I installed a clean XP to try it and see what do I should install on the client's machine.
I've installed the SP3, .NET 4.0 and copied the release package with all the DLLs mentioned in the build log (that made it work outside the MonoDevelop in the development machine). But I'm getting a "the application has encountered a problem and needs to close" error, with no exception, in kernel32.dll, offset 0012aeb.
I've tried to install the .NET 3.5 before the 4.0, updated IE (just in case...), copied more GTK# and Monodevelop DLLs to the exe's folder, installed the Mysql .NET connector, installed Mono 2.8... But nothing. Still getting that unexplained error.
Google and StackOverflow searches didn't help me. I've researched and tried a lot of things in the last twelve hours or more without moving from this machine.
Do you have any advice? What can be causing it? Is there any way to debug the exe (without installing VS...)? Does anyone know what are all the dependencies of this kind of executable?
WinDbg can help you figuring some JIT trouble...
Even though it aint intuitive and require skills, Worth a try. might pop something up.
If it's meant to run under Windows, then you should probably compile it with the Visual C# compiler.
However, more related to your problem - get a debugger in your deployment machine and run the application on it. This is the best way to figure out the problem because we really can't guess it.
Mono Application Deployment Guidelines
There are several options to installing Visual Studio on your production machine, one of them is the Remote Debugging Monitor. It does not require a Visual Studio installation. You can copy the files from your development machine to your server. I've got them under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger.
You can also use it for Remote Debugging of a Project Built Locally.

Porting ASP.NET application to Mono/Apache under Linux

I've got a relatively small ASP.NET project that was written using C# 4.0.
I was wondering if anybody had managed to port such a project over to running under a webserver on Linux, the latest information I can find appears to only have support for ASP.Net 2.0 - Configuring and running Mono ASP.NET 3.5 (AJAX.NET) on Linux computers
The project uses LINQ-to-SQL for the entire data access layer, and I know Mono itself support LINQ, so I thought it stands to reason that it should work.
I just want to know if it's a complete waste of time or not before starting.
Thanks.
I run an ASP.NET 4.0 application on Suse Linux using mono. My experience with mono is that it just works. My app is ~ 15.000 LOC and uses third party components like mongo-csharp-driver, lucene.net, elmah, munq, and sphorium.webdavserver.
I've had almost no compatibility problems during development - and the ones I had where easily worked out (for example sphorium accesses the registry; this obviously works different on Linux/Mono). I've even started developing with Visual Studio instaed of MonoDevelop and without the Mono plugin, because Visual Studio is a better IDE, and it just works when I compile my web app on linux and deploy it on Apache (even though I develop with .NET on Windows).
I've written a short blogpost on getting started with the setup
This is definitely not a waste of time. The company I work for converted our VB.Net application to C# so that it can run under mono. This application has over 200k lines of code. We now are running with Ubuntu/Apache/Mono/Postgresql on Amazon ec2.
The only concern I would have is with your database. If it is MS SQL then you will need to look at migrating to MySQL or Postgresql. Again we did this with 300+ tables and 900 stored procedures. It is definately something worthwhile in the long run.
I think that the best way to get started would be to setup a local environment running something like Ubuntu. You can get the near latest versions of mono from the repositories at http://badgerports.org/ or if you prefer you can the latest versions as build scripts which are maintained here. Install monodevelop and build your code on linux with mono. From experience the mono with C# is a pretty much a complete implementation of the .net framework. I would be surprised if there was something in your application that is yet to be implemented in mono.
I have an answer here showing an easy configuration for your application under apache. I use this configuration for mono applications running on Ubuntu.

Categories