Dotfuscator - Windows Service - c#

How to use dotfuscator to obfuscate Windows service?
We have created windows service application that includes multiple DLLs (custom as well as third party dlls) and we use installshield to create exe and we distribute the same.
We would like to know on how to start with obfuscate using dotfuscator.
As far as we reviewed, it looks like we will not be able to obfuscate the entire windows service exe and we will be able to individually obfuscate each dll. But not sure how to add these dlls while creating the service exe.
If someone can guide on how to obfuscate the windows service exe created using the install shield.
When we tried to all the exe file created using the installshield, we are getting the following error.
Invalid input assembly C:... . This is not a managed module. (C:...)
But when I tried a individual DLL it is able to obfuscate but the ouptut is in different folder. So we are not sure how to automated this entire process.
Environment: Visual Studio professional 2012, Dotfuscator version - 5.5.45x
We have not registered with Dotfuscator and we using the Dotfucator that is part of visual studio.

I work on the Dotfuscator team and am answering as part of my job.
It sounds like the EXE generated by InstallShield is not a .NET assembly, but a native executable. You can verify this by trying to open the EXE in a .NET disassembler/decompiler like ildasm and seeing if that also gives you an error.
I'm not too familiar with the way InstallShield operates when creating a Windows Service, but it sounds like you create the DLLs first, and then InstallShield takes those DLLs to create the installer package? In that case, you should run Dotfuscator after you create the DLLs, but before InstallShield consumes those DLLs. Then is it possible to configure InstallShield to use those obfuscated DLLs instead of the original ones?
With Visual Studio 2012 you have to run a Dotfuscator Project's build from the Dotfuscator Community Edition (CE) user interface (that you open from Visual Studio's Tools menu). Newer versions of Dotfuscator CE Visual Studio 2015 and Visual Studio 2017 can build from the command line interface once you've set up a Dotfuscator Project in the user interface. For automation, you could set up your build scripts to call this interface.

Related

How to add add some msi application to visual studio InstallShield Redistributables?

I used Visual Studio 2015 InstallShield Limited Edition Project to create my application setup.
My application must be installed api.msi, .net3.5 and .net4.5 to be exeuted.
In "Specify Application Data->Redistributables", I only can add .net3.5 and .net 4.5 to my setup. but i can't add api.msi to Redistributables.
How do i add api.msi to Redistributables?
this is my Redistributables
I hope the installation steps are as follows
run setup->set install path->install .net(3.5 and 4.5) & api.msi & application.
Best way to do it is by creating merge module and add it to your project for details refer the link
InstallShield can include either merge modules or prerequisites, but the Limited and Express editions do not include the capabilities to build either. Both options are available with the Professional and higher editions, and other tools may be able to create merge modules.
You can download an eval copy of InstallShield and throw it on a VM. Build your setup prereq file (.PRQ) for it. Copy the PRQ and api.msi to your machine with InstallShield LE and consume it.
You can read more about how to author a PRQ here: (Disclosure: My blog article from 11 years ago)
http://iswix.com/2006/11/21/using-installshield-12-to-install-net-framework-3-0/
I maintain an open source project called IsWiX that creates graphical UIs for managing XML documents. I thought about creating a tool to maintain PRQ files. It would only take me a day to write it but I was concerned Flexera might get really irritated. :)

Create a C++/CLI Project in visual studio 2015 with Platform toolset v120 (Visual Studio 2013)

I am using Visual Studio 2015 (Update 3) in Windows 10. I have one c++ project which is written with platform toolset v120. Now I want to use the codes of this project in my C# application. So I decide to create a C++/CLI Project (Class Library) and write a wrapper for the mentioned codes to be able to use them in my C# application. The problem is that when I change the platform toolset of my C++/CLI project to v120, the compiler give me this error:
LNK1104 cannot open file 'MSVCMRTD.lib'
But it works with the default platform toolset (v140). Please be informed that I don't have written any code in my C++/CLI project. I think one of the solutions is to install the whole Visual Studio 2013 besides 2015 version which is not a good solution. (I am not going to even try it). Any solution except installing Visual Studio 2013 would be welcome.
I found the solution and bring it here for further uses. I searched the library in my computer and add it to the "Linker -> General -> Additional Library Directories" in my project's properties.

C# Obfuscate source code which is getting installed using the Visual studio setup wizard

How could I protect my .NET applications source code (classes) which are getting installed using the visual studio setup wizard?
I've been using the https://yck1509.github.io/ConfuserEx/ application to obfuscate my exe and dll files. Now I want to serve the application using the visual studio setup wizard but it's delivering the class files and everything else non-obfuscated.
What could I do?
I appreciate any kind help.
You may use this. It does not cover the installer creation, but it should work anyway.
https://www.codeproject.com/Articles/1040107/Configuring-Visual-Studio-for-Obfuscation

InstallShield 2013 Limited Edition + Visual Studio 2012 + Installer Class = Error 1001

I have a VS solution in order to build an installer for a Windows Service.
I have the Limited Edition of Installshield, so i can't install windows services. Thus, I use the "Class Installer" Tip in my InstallShield project.
This solution was working until I change of PC.
If I build my Installer on my new PC, with the same solution, same version of Visual Studio 2012 and same version of InstallShield : I have an error message "Error 1001" during installation of my setup.
If I try to install my Installer with InstallUtil.exe, I obtain a BadImageFormatException (both with Framework x86 or x64).
In the new exe of my Installer what doesn't work, the DLLs are the sames than on my older PC, but the MSI is not the same.
You have an architecture bitness mismatch somewhere in your calling sequence.
Heath has a good explanation here that still applies to later VS editions as far as i know.
http://blogs.msdn.com/b/heaths/archive/2006/02/01/64-bit-managed-custom-actions-with-visual-studio.aspx
Also, if any of your code is AnyCpu then it will start out as 64-bit and be unable to link to any 32-bit Dlls, but your issue seems to be at the first call in the custom action.
If you can avoid VS installer classes then do so.

C# project 2010, standalone executable on other computer

I have a C# project that I have created in Visual Studio Express 2010. This program uses a 3rd party C# class that relies on/calls a C++ dll. I just copied the filename.dll into the bin/debug and bin/release folders of the project folder, and the application ran fine.
I am under the assumption that I can copy the release executable for the project to another computer and run it as long as the filename.dll is in the same directory as the executable. However, trying this on another computer with correct frameworks installed, etc. the program crashes with a system.dllnotfoundexception.
Strangely, my friend reports that the program runs on his computer with Visual Studio installed, but not the one without, though I have not actually seen this.
What could be causing this? And how can I get the release executable to run on another machine?
Thanks for any replies!
-Chase
Make sure you have the Visual C++ runtime installed (VS2005,VS2008,VS2010).
If your c++ dll is build by visual studio it may depends on the CRT, two things to check here :
If it depends on the release or debug CRT. Microsoft don't give you the right to distribute the debug version except for debugging purposes so it could be a problem.
Witch version it depends on
The last version from vs2010 could be copied in the same directory as the executable (msvcp100.dll for c++ msvcr100.dll for C)
Previous versions needed to be installed as side-by-side assemblies so running their setup was mandatory (Some versions like the VS2005 one are included in framework install but others like the VS2005 SP1 one need to be installed separately)
In any case the best way to debug such problems is to install Dependency Walker (free) on the computer having problems and let it tell you what dll is missing.
The easiest (albeit maybe not the "best") solution to this problem is adding a Setup project to your solution. A setup project will help you find any dependencies, and make them available during install.
The steps you need to take are the following:
Add a Setup project to your solution (found in Add project.../Setup templates)
Right-click the project, choose "Add/Project output..." and add the startup project of your program.
Right-click the project and choose "View/Custom actions".
Right-click the root node, select "Add Custom Action..." and from "Application Folder" add "Primary output from [your project name here]".
Now when you compile, an .msi installer is created. Run this installer on the other computer, and your program will be installed and runnable. To uninstall, run the installer again, or remove the program from "Add/Remove programs" under Control panel.

Categories