Archived Forum Post

Index of archived forum posts

Question:

Linker options with C# Visual Studio 2010

Mar 12 '13 at 00:35

The linker options described in http://www.chilkatsoft.com/refdoc/csZipRef.html under the Methods, addEmbedded, seem to be specific to C++.

Important: In Visual Studio 2010, the linker has a property “Randomized Base Address” (Project Properties/Linker) that defaults to “YES”, but the default is “NO” in Visual Studio 2008. (The property is nonexistent in Visual Studio 2005 and earlier.) This enables ASLR ( Address Space Layout Randomization) in Vista and up, and prevents the proper code injection in the executable address space. To successfully embed a .zip as a resource within an EXE, this Visual Studio property must be set to "NO".

Does anyone know how to apply that to Visual C# in 2010. I can't seem to get the method to work for me properly.

Any suggestions would be greatly appreciated.

riobel911


Answer

I found a few references on the internet stating c# has no need for a linker, which would explain why there is no linker option. Probably over simplifying it.

Anyhow, what I ended up having to do is write the receiving .exe with C++ to set the /DYNAMICBASE:NO option, and it worked as described. I left the project that is doing the embedding in C#, as ASLR has no impact on that process.