Making my app stealth (avoiding leftovers) - c#

I have a portable app that isn't stealth. And by stealth, I mean:
"Stealth" means when an application is launched, used and terminated properly, it does not leave behind any entries in the registry or filesystem.
My app runs under .Net Framework 4.6.1 and leaves behind a log file under the folder:
%AppData%\Local\Microsoft\CLR_v4.0_32\UsageLogs\ [App Name].exe.log
Who is creating this log file?
Is there any way to avoid the creation (without breaking the app)?
What's the purpose of this log?

With Windows 8 (.NET 4.5), a new NGen mode: "Auto NGen" has been
introduced. Basically, the .NET runtime generates usage logs for
managed applications. Source
Every time the application run it creates a new type of logs called
“Assembly Usage Logs” in the AppData windows directory.
Source
On my research I found out mostly that it only does this job on Windows 8+.
But in this source it says also on Windows Server 2012, but I have tried it on a Windows Server 2012 R2 and could NOT reproduce it!
I did not find a way to disable this, one solution could be to target a lower .net Framework within our application.

Related

Is There Such A Thinig As a C# Application Link Map Or Something Equivalent?

Is is there a C# build construct available that would allow me to create a link map containing symbols and offsets? I need to debug an application that is throwing an exception when running scheduled out of Task Scheduler.
Here are some details of what is going on: I have developed a C# application on Windows 10 Workstation (non-server). I am trying to run this application on Windows Server 2012 R2, which, like the Windows 10 system, has .net framework 4.5.1 installed.
The application runs with no known errors on the development workstation, whether it is run installed or out of Visual Studio 2012.
However, the application will not run at its scheduled time out of Windows Task Scheduler. This is the error 0xE0434352 -- I have been reading SuperUser and stackOverflow posts about this error -- and the Windows application event log shows an exception has occurred.
However, the offsets in the application event log are not a lot of help without having a map of the executable.
Is creating a link map or equivalent possible?
Here is a link to one description of a linker map for gcc.
in .Net the assemblies are self-describing. A debug database file is useful, but not necessary to describe the objects and how the code is structured. So I would not think a link map are relevant for .net assemblies.
You might want to take a look at dnSpy, this is a combined de-compiler, debugger and assembly editor. It is often useful when trying to debug errors. It is however limited to managed code, so it will probably be less useful if the error is in native code.

AppDomain missing or depricated in Windows 10 IoT Core and UWP

For an app for Windows 10 IoT Core on Raspberry Pi2, I need to use a launcher app or StartUp-Task, which creates a shadow copy of my app and launches it. I need to use this approach to be able to substitute DLLs during runtime, without having a lock on the DLLs and without disrupting running services. That's needed as the device running it, would be remote somewhere out of reach, deployed at a client's site and I need my app to be running to service the device. After updating my DLLs, I would restart it and it would run with the new libraries, start the launcher as default app, which then starts my app.
Before Windows 10 and UWP the approach was to use System.AppDomain from mscorlib.dll in the .NET Framework to create a new AppDomain in a cached directory. The config, executables and DLLs would be copied to a cache directory and run from there. That leaves the original DLL available for substitution and doesn't put a lock on them. This was also a very useful technique used in IIS and webapps, which needed to run without interruptions even if the code needs updating. The open threats keep servicing open requests until these are done and new requests will be serviced using the new updated versions.
Now in Windows 10 System.AppDomain is not available anymore. I tried Windows.System.ProcessLauncher but encountered several issues with it. First I have to register the EXE in the registry to allow launching it. Then it tells me I can only run it from an app container. I didn't get it to work as of now. It's just a tedious and messy approach IMHO.
Now to my question: What would you use as an alternative to the described old approach on Windows 10 IoT Core? Does anyone have a small snippet of sample code to share? Or perhaps a link pointing in the right direction? Any advice would be appreciated.
This approach is not compatible with the Universal Windows Platform app model.
You will have to push an updated package of your app.

How to automatically update a C# .Net console application?

I have a Console application (executable) written in C# .Net that users download and run locally.
The users download a zip and extract it to a local directory and run (using command line parameters) via the command line from that location.
Since users will not check for new version I need a way for the executable to check for a newer version of itself and automatically download it and overwrite itself (or at least notify the user).
I have looked at the possibility of using clickonce but that is geared towards windows applications.
All the questions/threads I have looked at only concern auto updating windows applications so are no good for this scenario.
Is there a way (or pattern) to auto update a .Net console app or do I have to write code within the console app to check its version against the server and notify the user?
If its made Clickonce it will break it as a console app - http://social.msdn.microsoft.com/Forums/en-US/8be48914-6563-47cb-9bff-e5e72047bb69/c-console-application-always-is-a-click-once-app

Win Form exe closes immediately after launch, deploying a win form application using setup project

I have created a win form application in c# with sqlce. I followed the steps here http://erikej.blogspot.dk/2013/10/sql-server-compact-4-desktop-app-with.html making some tweaks along the way since I was using sqlce 3.5 .net and that blog was talking about 4.0 .net.
When I finished the application, I created a set up project and build it which gave me an msi and setup file.
Now when I run this set up on my own machine where I developed the applicaton, it works a charm.
I tried it on a friend's machine as well, it worked well, he had visual studio 2010 as well on his machine.
Now when I tried it on 2 other machines with VS, after installation, on launching the exe, it launches and immediately closes, I do not see anything although.
I know it launches as i look at processes from my task manager it shows it in there for like 3-4 seconds and its gone.
I tried using this Not able to run the .exe file created from c# where i wrapped the try and catch around all the code inside the root win form but no text file was created with any errors.
On doing some research, it says it could be because I am missing some dll's, how do i make sure all the dlls from the references would be copied into the project ? I set all dll's to true for copy local.
Is this something else and not related to dlls?
I really just want to be able to install the application on any machine without any problems.
Thank you for your time.
EDIT
I need to add that this was a project that involved using an XBox controller sending data to a wireless receiver that was hooked to a PC. I used the XNA framework to intercept these and display some form of output on the Win Forms.
When packing and installing/deploying an application that makes use of the XNA DLLs on another non developer machine, the XNA framework needs to be installed.
My solution was packing my application along with the xna installer and so the xna framework installs as a prerequisite and then my application installs and then it no longer crashes.
Thanks to mrlucmoring and Mark for their support and troubleshooting.

.NET development for pos pc

I'm developing an application for a pos-pc running windows xp, this application is based on .NET framework 4 and use wpf for the UI.
I need to increase the performance of such application, I've read about ngen for generate native image but I don't understand very well how it works and how to use it.
Any tip, link, tutorial about ngen will be much appreciated.
I need to create a lightweight version of windows xp capable of running .NET framework 4 and use some COM object but i don't know what I can remove from the XP installer (using nLite).
I've tried Windows embedded 7 standard but the Intel gma driver are not compatible and i can't install it.
Thanks
check this one: Improving WPF applications startup time
in short, ngen is an utility that compiles the IL code generated by Visual Studio build process into machine dependent code which does not require the JIT to compile IL anymore at runtime.
How can ngen be relevant for a POS? DOnt getm e right, but this handles startup performance and POS get turned on once in the morning if at all (i.e. if they dont stay up overnight). If you ahve a WPF performacne issue may I suggest you fix those, and dont dabble with native image gneration?
Does the machine have network access? Perhaps moving business logic from the client to a service on the network would improve the performance, so that the client becomes simply a UI shell for the service.

Categories