Ben
Ben

Reputation: 4319

My EXE runs fine if it has the rest of the debug folder available, but not standalone

I have a WPF application, that I want to deploy as standalone so that a user can download it from a website and run it without having to install it.

It runs fine (from any machine) so long as it has all of the files in the debug folder with it:

enter image description here

If I try to run just the EXE without the other files if crashes. Is there a way I can streamline these files into the EXE so it can be run standalone?

(There is a background image on the form, but this is set to Build Action = Resource, so I don't think this is the issue. Also the image does not have to copied to the other machine in order to run, just the files shown above.) The errors from the event log are:

Faulting application name: AMBootstrapper.exe, version: 1.0.0.0, time stamp: 0x572caffc
Faulting module name: KERNELBASE.dll, version: 10.0.10586.162, time stamp: 0x56cd55ab
Exception code: 0xe0434352

and:

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.

EDIT: After more testing I can remove most of the files, but the one I can't is AMBootStrapper.exe.config

Upvotes: 2

Views: 82

Answers (1)

Ben
Ben

Reputation: 4319

As per @BenJackson the issue was that the WCF service details were in the app config.

Solution was to remove this from app.config:

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IService" allowCookies="true" maxReceivedMessageSize="184320" maxBufferPoolSize="184320" >
                <security mode="Transport">
                    <transport clientCredentialType="None" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://svc.myserver.com/MyService/Service.svc/Service.svc"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService"
            contract="MyService.IService" name="WSHttpBinding_IService" />
    </client>
</system.serviceModel>

And replace with this in code:

WSHttpBinding binding = new WSHttpBinding();
binding.AllowCookies = true;
binding.MaxBufferPoolSize = 184320;
binding.MaxReceivedMessageSize = 183420;
binding.Security.Mode = SecurityMode.Transport;

EndpointAddress address = new EndpointAddress("https://svc.myserver.com/MyService/Service.svc/Service.svc");

MyService.MyClient c = new MyService.MyClient(binding, address);

Upvotes: 1

Related Questions