C# .net 4 dependency - c#

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

Related

C# only run application if depenancies are installed

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?

Deploy a WPF application with .NET 3/3.5 in a single executable

I have developed a WPF application and the customer is planning to deploy the application on DVDs.
My application is really simple and doesn't require any setup process, but I need to assure that if the client doesn't have .NET 3 installed that it will be installed locally (from the DVD) before starting the WPF application.
So, what's the easiest was to add the .NET 3/3.5 package locally on my DVD and assure it'll be installed before running my application? Remeber that my application will be a standalone application.
when you use the publish option...
The Project Properties has a place to specify the dependancies that will need to be downloaded
then you simply check the boxes
there are other more complex ways to go abaout this but for .net 3.5 you don't have to go far
I would suggest using Visual Studio Setup Project for creating a setup package which would check for prerequisites and provide fundamental features like file system, registries, scripting. It is very easy to get started with. Take a look here for a brief walkthrough.

How to make machine independent and .Net framework(dependency) independent 'EXE' file from .Net

I am creating a project on C#-.Net. The 'exe' file generated from the project is not executable on machines which do not have the .Net already installed. This error is popping up:
To run this application you first must install one of the following versions of the .NET.Framework: V4.0.30319
I don't want to make an installer file which installs the dependency files (.Net FW and other...) on PC.
As project requirement, I want to make an 'exe' that runs on every Windows PC without installing software or dependency sofware -> .Net FW. Just when clicked and the s/w exe should execute.
Is it possible to make such machine independent 'exe' for Windows from .Net ??
That's not exactly possible (there are some tools out there that will allow you to bundle dependencies, but I wouldn't recommend using them).
Your best possible approach to this is using an as-old-as-possible framework, for example .NET Framework 3.0. This way you'll use a framework version that is already preinstalled on pretty much all systems in use. Or in other words, you'll ensure your program runs on as many systems as possible out of the box. Just provide a link to the runtime in case someone is still missing it.
Also just to note that this is far better compared to what happened to the first few iterations of the .NET Framework: Those executables would just crash with a complex error message not telling the user that it's just the runtime missing. It improved a lot over time.
Also, just as an alternative: Have you thought about using ClickOnce deployment? This will allow you to provide users a simple and minimal installer they won't really see either. It will only download and install dependencies that are still missing. Also this is built into any edition of VisualStudio, even the Express ones.
This error is popping up
It is not an error. Just a friendly reminder to the user that your program need .NET 4 to be available before your program can run. He'll click "Yes, please!" and everything solves itself automagically.
You could create an installer to avoid the message. But, given that you don't want to do that, and it already takes care of it for you, there is very little point.
More about what this all looks like and why it works this way in this answer
"As project requirement, I want to make an 'exe' that runs on every Windows PC without installing software or dependency sofware -> .Net FW. Just when clicked and the s/w exe should execute.".
1) What if the version of Windows doesn't have any .Net Framework?
2) What if the version of Windows doesn't support any version of .Net Framework? (.Net didn't come around until Win2K/ME ish times, and Windows 95 won't take most .Net frameworks, 3.1 / 3.5 wont even take Mono)
"Is it possible to make such machine independent 'exe' for Windows from .Net ??"
Sounds like you're trying to make something like a Setup.exe that can be a single download that will work out the specifics after the fact... Actually the "machine independent" makes even C++ unsuitable, because while C++ will work on Windows, Mac, Linux, Unix, and a whole slew of more exotic systems with x86, x64, i64, PPC, ARM24/32/64 etc. (all of which exist with Windows installed on them, out there, in the wild, but are pretty rare) once the executable is compiled and linked, it will be targeted towards a single CPU architecture and OS. (OS/2, GEM and DOS all use .exe files, and there are some similarities between them, but most other OS don't require any specific file extension for executable binaries)
So, .Net isn't a terrible idea for this reason, any more than a .jar, .pl or .py would be. (which is relatively common for *nix software that you hope will run on Linux, Mac and BSD Unix... maybe even Solaris or HP/UX etc.) If you target MSIL, rather then x86 or x64, then your .exe will run on PPC Windows, DEC Alpha Windows, Itanium Windows, and ARM Windows, as well as the other two. (although this isn't what you are asking about) If you build it without a dependence on the WPF, or other Windows specific GUI engine, it will also work on Mac, Linux and BSD, so long as they have Mono installed. (it just may be worth considering, while you're at it... Versions of Windows Microsoft don't support with the appropriate .Net version will also need Mono to work this way)
To that end, I would recommend building a command-line executable in Mono, rather than .Net development environment. (Mono executable will run on .Net easier than .Net executables run on Mono... Though either is possible if you are careful about the dependencies you include in headers you import into your source)
I've had some success with this, writing a background service that would install on either Windows or Linux with the same binary executable. I used MonoDevelop. (https://www.monodevelop.com/) However, it's really just a flashy IDE around the core Mono development tools. (https://www.mono-project.com/)

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.

Differences in development between .NET and Mono

I'm looking into Mono and .NET C# and we'll be needing to run the code on Linux Servers in the future when the project is developed. At this point I've been looking at ASP.NET MVC and Mono.
I run an Ubuntu distro and want to do development for a web application, some of the other developers use Windows and run other .NET items with Visual Studio.
What does Mono not provide that Visual Studio does?
If running this on Linux later shouldn't we use MonoDevelop?
Are there some third party tools or add-ins that might be an issue with Mono later?
What does Mono not provide that Visual Studio does?
MonoDevelop is presumably what you mean here. MonoDevelop offers cross platform development on Linux, Mac OS X, Windows based on GTK. However it is not as polished as Visual Studio for obvious reasons - it's 3 people making it, not hundreds. It has some nice features, especially its source control plugin architecture. However as Visual Studio Express is free there aren't many advantages on Windows to using it.
It uses the same .csproj and .sln format as Visual Studio, however the XML docs format is different.
If running this on Linux later shouldn't we use MonoDevelop ?
As I mentioned above, the project formats are inter-operable.
Are there some third party tools or add-ins that might be an issue with Mono later?
Unlike Visual Studio, there aren't a huge wealth of add-ins for Monodevelop. The ones that you use in Monodevelop won't effect your .csproj files at all, as anything Visual Studio cannot read it generally ignores.
As people have said don't confuse Mono for MonoDevelop. MonoDevelop is an IDE for Mono that originally came from (forked) SharpDevelop.
Mono is the cross platform framework that 'apes' the Microsoft CLR and framework libraries.
I don't have much experience in this area but...
The Mono Project Roadmap has an overview of features that are new, upcoming, and not present in Mono compared to MS.NET. Even where Mono has the same classes as .NET, note that compatibility is not 100% (although that is generally their goal). I'm not sure if there exists a comprehensive list of things missing in Mono.
MonoDevelop is now available on both Windows and Linux so you're probably best off using it. However, MonoDevelop does appear to use the same project file format as Visual Studio and SharpDevelop, so you could make an attempt at mixing IDEs.
Of course, when using 3rd-party .NET libraries, note that many of them have not been tested with mono, and in particular anything that uses P/Invoke will not work on Mono for Linux. However, most incompatibilities with mono are minor, and if you stick with open-source libraries you can always fix any incompatibilities you run into.
You might also take a look at Mono Tools for Visual Studio. It lets your visual studio developers target and test with the mono platform.
You're aiming to always have support, and/or primarily use the software on Linux, correct? This is actually a question I asked the Mono developers at a conference a little while back, and it basically boiled down to what you want to do with it.
If you want it to always work on Linux, then use Mono. If you only care about Windows, then use Visual Studio.
If you're using Mono, then use MonoDevelop across all developers. It'll just make life a lot easier later on, and it'll make sure that whatever you write in the one will work for everyone.
Unfortunately, I do not know the answer to the exact limits/advantages of Mono vs. .NET, aside from .NET being further ahead, and Mono playing catch-up, nor about different addons.
If none of your developers need to develop on Mono for certain features, I suggest you all use Visual Studio on Windows. Then test the applications on Mono via
Mono Tools for Visual Studio
manually copy the binaries over
check out the code on Linux and build in MonoDevelop.
Personally I experienced a lot of small troubles when I tried out the third way, but luckily I am capable of finding workarounds.
It is only when you touch Mono, you know which part of your application needs to be tuned.
http://www.mono-project.com/Start
If you can help it, it'd recommend avoiding the Mono implementation of Remoting. There seem to be some unexpected hiccups and debugging it is not straight-forward.
We had a very Remoting heavy product that we tried to port to Mono so we could support Linux. Due to being unable to resolve the Remoting issues, we eventually had to abandon our attempts at supporting Linux altogether.
Caveat: my experiences may be outdated. See comments below
You don't need MonoDevelop in order to run ASP.NET program in Linux, make a shared folder on your development server (VMWare'd or real one), test often so you can easily work-around what's missing from Mono
That's the same approach I'm using in my .NET Remoting program I host on Ubuntu server. But I do the reverse, since I'm a solo programmer, I make a shared folder on my Windows development machine, then access that shared folder on my Ubuntu test server (vmware'd). On ASP.NET stuff, if the changes don't reflect on your Ubuntu test server, in Terminal just touch the Web.Config file in your Ubuntu test server. i.e. touch Web.Config, then refresh the page
Mono has a fully functional implementation of ASP.NET. This includes full support for ASP.NET Web Forms and Web Services. This essentially means that more or less any ASP.NET application that you have developed using with the .NET Framework will work with Mono. Obviously there might be changes needed, such as data access changes, removal of any
reliance on .NET Framework BCL types . Mono- Oracle users-.Net Programming C# : ubuntu 11.04

Categories