Solved

c# locate resource file

Posted on 2011-03-01
4
376 Views
Last Modified: 2013-12-17
Hi,
I develop my app on eg. f:\myapp\ where I save my resource file in the app.conf where
I indicate my resource file location as f:\myapp\resources\res.bin.
When I copy my program to other computer and run on c:\ drive. The program coult not start because it is looling for f:\ drive. How can I solve this issue?

Thanks,
JT
0
Comment
Question by:jtran007
  • 2
4 Comments
 
LVL 8

Assisted Solution

by:crysallus
crysallus earned 200 total points
ID: 35014788
To specify the file resources\res.bin relative to the location of the executable, use:

Application.StartupPath + Path.DirectorySeparatorChar + "resources" + Path.DirectorySeparatorChar + "res.bin"

Open in new window

0
 
LVL 7

Accepted Solution

by:
mkobrin earned 300 total points
ID: 35014794
Go to the properties of your resource file in you Visual Studio IDE and set the option to copy the resource locally and then recompile the code. The resource file will then be local, and you will not have to another drive to find it.
0
 

Author Comment

by:jtran007
ID: 35023702
HI,

But what is the syntax to open this file? ".\resources\res.bin"

Thanks,
JT
0
 

Author Closing Comment

by:jtran007
ID: 35380741
Thanks,
JT
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
help with regular expression to search string 6 24
List<PaisEntity> - show some 1 24
VB.NET 2008 Publish Error 2 27
location of a form 2 13
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question