obfuscator and linker for .net - c#

I am in need to develop a desktop application which will be quite light-weight but dont want my end users to install full-fledged .net framerwork to run that. I've done a lot of research and my findings are:
1. using some .net linkers, i can achieve this goal. some of them are salamander, spoon.net(not 100% sure about its functionality), rustemsoft etc.
2. I am coming across two tools for this: Obfuscator & linker. Now I know obfuscator basically is used to eliminate the reverse-engineering possibilities of a code and to secure it but i've found that many obfuscators also include .net linker feature
so kindly can anyone enlighten me that for me to achieve my goal: running my .net developed application in end user's Windows (XP to be precise - though its quite defunct), can i use some obfuscators like that of rustemsoft to create a standalone and ready to deploy exe with no dependencies on framework?

Related

How to Install a Driver as Part of a Winforms App

I am currently working on a WinForms app in Visual Studio 2019, which uses a USB to I2C adapter to read EEPROM register values from a device. The manufacturer of the adapter provides the driver for the device in a downloadable zip file on their website which contains the .inf and .sys files among other things. I would like to have it so when the end user installs the app, the driver is automatically installed as well. What is the best way to do this? I have a Setup project in my solution, which I can use to put the driver files in the application folder, but that doesn't mean the driver is actually set up.
I found one potential solution that used System.Configuration.Install, but my targeted framework at the moment is .NET core 3.1, which unlike .NET framework does not have that namespace. I am only expecting users to use Windows 10, so I theoretically could switch to .NET framework for that namespace if necessary. However, I don't know if that will break anything in the app or if that is the easiest way to go about this.
I am very new to deploying apps so I really don't know the best way to go about this. Any direction is appreciated.
There are third-party .net core ways of doing this, such as
Core.System.Configuration.Install
Porting of System.Configuration.Install for .NET Core. (.NET 4.0
version)
Use at your own risk
however, there are also oodles of installers that have this capabilities.
Lastly, this can also be done with powershell, P/invoke and I believe there was talk in github about releasing this source code however you will need to track that down and follow the trail yourself

Packaging platform-native (C++) code with C# bindings using nuget

So, I've been searching around about the ideal way to build a cross-platform .NET (C#) application that also relies on some native code bits.
Since I couldn't find a de-facto way to build these things together, I turned by attention into the following workflow:
Build native code (c++ -> native "dll"(.dll/.dylib/.so/etc);
(Generate bindings, w/ SWIG or something, or have a project with them);
Package said project into NuGet;
Consume from the cross-platform application.
Now, Microsoft itself has some suggestions about this. But this - and all other - guides I've found so far have the same quirk: include pre-compiled binaries into the folder structure. This bothers me because:
It makes version control hard, because you have hard-copied build artifacts;
It completely breaks CI/CD because you can't just have a matrix of CI machines each one doing their build/package/upload.
It breaks the development workflow because you need to constantly be building + copying files over.
But, looking around in the NuGet Gallery, there seem to be packages more in the direction that I thought of, for example in the SkiaSharp, and Avalonia packages.
My idea is that there should be a series of for-one-platform-only packages (plus eventually an "aggregator" package) that could be transparently consumed.
Is this a possible workflow? If yes, how? If not, what is the currently agreed upon workflow, and how does it tackle the issues I mentioned?
Just to make it clear, I want to develop the native library and consume it in the cross-platform .NET (5/6) application in a simultaneous fashion, it's not that I'm binding a mature library, with periodic releases, that would make the mentioned workflow easy.
Thank you.

Running C# application with .NET - MONO

I have a simple application made using C#.
Now how do I make it , such that it runs on all systems.
If a PC does not have .NET framework installed - it shouldsiliently install it with only the bare minimum requirements that the program needs.
Installing .NET framework - too big in size compared to many program , which is just a few kilobytes. Also is shoulf be silent and only if required.
Basically the application should be light and capable to run in all Windows systems.
Not interested in getting to Linux users.
Should I use Mono Project.
Else is there a way to get the bare minim .NET framework selectively pre-installed.
Please advise.
Thanks
Have a look at mkbundle. It will create a standalone executable, with no other dependencies. In particular it does not need neither the Mono runtime nor .NET to be installed in order to execute.
The size might still be a problem (it will likely be several megabytes, even compressed), so there is another tool to strip out everything you don't need from the assemblies: the monolinker.
Note that the size will likely not reach the kilobyte range even after doing all this.
You can do this with a lot of work and the help of the Mono framework. See Embedding Mono for more information.
All that considered, it would be much easier to use a boostrapper to get a version of the .NET Client Framework installed. But you're going to lose the ability to install silently or be in the "kilobytes" footprint.
Unfortunately you cant run a .NET program on a machine that does not have the .NET framework installed and the installer of the program could be made to download the framework automatically but not in .NET .
To run .net applications you need the .net framework installed, that should be either the full version or the limited client profile edition.
The easiest way is to create a setup project from VS and require the .net version you want... the installer should be able to install the .net framework from the internet so you are not required to ship it with the app, which you can do by the way from the installer.
Mono won't be different since it still needs to be installed on the system. Mono however has full AOT support, but I don't have any idea whether that would help you or not... it is still a huge overkill anyway.
If you need your app to be small and run on ANY windows without any dependencies, you should do in c/c++ or vb6 whose runtime ships with most windows versions.

C# - Install .Net framework4

I want to ask about .net framework4 . it take along time through installing, is there a way to shorten the time of installing .
for example, can I make program to install it manually by installing only dlls that I use in my application?
Short answer: no.
If you are writing a client-side application, then you have the option of targeting the .NET Framework 4 Client Profile if you want to. This would be a smaller install (if implemented correctly).
However, the best solution in my opinion would be to require .NET Framework 4 as a prerequisite for your app, rather than attempting to bundle it. It's much easier, quicker and more reliable for an end-user or system administrator to obtain .NET themselves from Windows Update or other trusted source, then install your app later.
The quick answer is no; you cannot pick and choose which .NET DLL files to include as part of your code in order to reduce the size of the install.
However, having said that, there are some tools out there which will merge assemblies together into one file. But I don't know if that scales to including all required .NET assemblies. I doubt it very much.
If you're willing to use .NET 2, see Salamander linker. Disclaimer: not for all projects.

Can C# apps run without the .NET framework?

I intend to learn C# and start coding Windows .exe applications, but the only thing that is holding me back is that not all potential users have the .NET framework installed and therefore would be unable to run my application.
Is there any way around it?
Thanks!
No. c# only target .NET (or a comparable framework, such as mono). As an aside, Win7 comes with .NET preinstalled, and I believe Vista did as well. There are also a ton of MS apps which require .NET. It's getting near ubiquitous on windows machines, so I wouldn't worry about it.
YES, there was XenoCode that can wrap everything that your app needs and runs it in as a standalone. I don't know what kind of dirty tricks they use, but there IS a way.
Now it's Spoon
From their site:
Spoon Studio
Easily virtualize all of your applications for instant,
zero-install delivery on Spoon Server and Spoon.net.
Spoon Studio lets you convert your existing software applications into virtual applications
that run with no installs, conflicts, or dependencies.
BTW, I'm in no way affiliated with them - just curious if the community will accept it or flame it.
Yes, with .NET Native.
Instead of compiling to intermediate language, it will compile to native code and run with statically linked .NET libraries. Therefore, there will be no .NET Runtime requirements for end users.
https://msdn.microsoft.com/en-us/vstudio/dn642499.aspx
https://msdn.microsoft.com/en-us/library/dn584397(v=vs.110).aspx
Does not work before Windows 10
C# is just a programming language. From a strictly technical point of view, someone could develop a C# compiler that targets the Windows API or <insert your target platform here> directly. Sure, it would be a lot of effort because C# was designed to fit .NET, which means the compiler writer would essentially have to re-implement .NET to provide all C# features.
From a practical point of view, you just want to use C# to target either .NET or Mono.
Microsoft started shipping .NET 2.0 with XP since 2005. So, even if your target machine was bought somewhere within the last 8 years, it should still have .NET.
If you are targetting the linux machines on the other hand, there is the mono framework available for that. You don't even have to include it, most repositories like ubuntu, debian, etc. has packages available for mono in their repositories. All you have to do is make your own package dependent on Mono runtime.
NO as simple as that
Everybody might say that it is already installed/ or you need the runtime. But that means YOU NEED IT
It's not about C#. It's about whether you want to develop managed or unmanaged applications. C# is the choice for developing managed applications which run on .NET Framework.
If you want to avoid it, you can go to Visual C++ (without .NET) development using Visual Studio
However, .NET framework comes pre-installed with latest Os like Win 7 these days.
Microsoft makes a redistributable installer that installs the version of .NET that you require. It bloats your install, but it's pretty much the only way to do what you need.
You'll need the .NET Runtime. However, most of the PCs running windows already have it.

Categories