Click here to Skip to main content
12,699,492 members (35,607 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
Hi, I just finished my application, but when I moved the exe on my desktop I got this error:
System.IO.FileNotFoundException: Could not load file or assembly 'HttpService, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Can not find the file.
File name: 'HttpService, Version=, Culture=neutral, PublicKeyToken=null'

did I miss anything?

any help would be highly appreciated.
Posted 3-Feb-13 4:29am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The reasons can be different.

Please see my two comprehensive answers which explain how to work with all kinds of paths:
How to find my programs directory (executable directory),
How to find my programs directory ("special folders", working directory).

I want to reiterate that there are no situation when using any hard-coded file path can be useful. In all cases, paths should be calculated during run time based on user input, configuration files, etc, based on the methods I described above.

Kishor Deshpande 3-Feb-13 22:02pm
My 5
Thank you, Kishor.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi Maxbre,

You are probably using a relative path to a file (which file?) that is found relative to the Debug folder, but not in the same relative path to the Release folder.

maxbre 3-Feb-13 9:57am
Ok thanks, I saw that the application is looking for C:\Users\Max\Documents\Visual Studio 2012\Projects\HttpService\bin\Release\HttpService.exe. I have a reference to a windows service that is hosting a wcf service. The httpService.exe is supposed to be runned as a Windows Service on a server while the HttpClient.exe is running on other computers. How can I keep the reference without the HttpService.exe in the same directory?
Edo Tzumer 4-Feb-13 0:47am
What I usually do is keep a config file with such params.
The config can be set on the Visual Studio to be copied to the output folder on compilation.
Using relative path is as bad as using absolute path.
The problems are using 1) any hard-coded path at all, 2) using working directory based on assumption that the user never changes it.
Please see my answer for detail, it's more or less comprehensive...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100