views:

502

answers:

2

I am trying to reference LINQPad.exe, a .NET executable, so that my code can make use of its wonderful .Dump() extension method. Adding a reference to the exe allows me to use the following code on my dev machine, but it breaks ClickOnce ("Reference in the manifest does not match the identity of the downloaded assembly LINQPad.exe.").

public static string DumpString<T>(this T o)
{
    var w = LINQPad.Util.CreateXhtmlWriter();
    w.WriteLine(o);
    return w.ToString();
}

Does anyone know how to reference a .exe and deploy it with ClickOnce (or a similarly easy method)? Note that I cannot just include the .exe and call it as a process - I need to reference it as an API. Also, LINQPad.exe has assemblies inside of it which cause problems when attempting to use ILMerge on the file, so ILMerge doesn't seem to be an option.

+1  A: 

The LINQPad EULA does not allow you to redistribute without written permission from the owner of LINQPad.

You are not permitted to do what you want to do because it is illegal.

However, there is permission granted on the website to disassemble the executable to satisfy your own curiosity. I therefore suggest that you reverse engineer Dump() and post it to Codeplex as a separate library for all to use.

Randolpho
The developer of LINQPad has already answered questions about using the Dump method - take a look at the first link in the question (Joe Albahari is the dev).
Pat
I saw that; I figured he was suggesting you only use it for development scenarios. Do you really need it in a production deployment? If you do so, you are redistributing the product, which is a violation of the EULA. I highly suggest you consider reverse engineering it.
Randolpho
I don't need it in a production deployment. Looking at the dependency graph (using .NET Reflector) for the LINQPad.Util.CreateXhtmlWriter method shows that there would be a lot of reverse engineering necessary. I'm not willing to spend the required amount of time to do that.
Pat
A: 

Not knowing about LinqPad, here's a stab in the dark:

You could try this: (no promises) I'm assuming you are referencing it in your project.

Add the linkqpad.exe to your project. Set the build action to none, set copy-to-output-directory to false.

If you have a reference to it, delete your reference to it, set your reference to point at the file you just included in your project. This way, it will reference the local copy rather than the one in the GAC. If you don't have a reference to it, set the build action to "content" and set copy-to-output-directory to false. Then where you're calling it, look for it locally.

This is how you would generally deploy a 3rd party dll locally rather than installing it in the GAC (works for DirectX, but not for Infragistics). I don't know if it will work for an exe...

RobinDotNet

RobinDotNet
Thanks for the suggestion, but the problem rests on the fact that I am already referencing the exe locally. The file gets copied into the ClickOnce deployment folder just fine, but the application launcher fails because of a manifest conflict. If I were referencing the exe from the GAC, I don't think that I would have this problem.
Pat
And you can't install it in the GAC because that's not legal, right?
RobinDotNet
I'm not sure about the legality of installing it in the GAC. That might be an ok workaround. LINQPad comes as a single exe rather than an installer. I'll look around to see how I can install that in the GAC. Thanks for the idea.
Pat
If you have an installer, you can wrap it with the Bootstrapper Manifest Generator and deploy it as a prerequisite. Don't know if that's legal though. (Just because you can, it doesn't mean you should.) ;-) Good luck!
RobinDotNet