Page 1 of 2
DLL change path
Posted: 24 Oct 2011, 10:35
by Erjen
Hello,
Nice forum! Hope you can answer my question.
I have a DLL file that points to C:\map and I can changed that directory (with Reflexil, plug-in for Reflector) and that works fine. But what I actually want is that it points to its current directory without defining C:\ etc.
Is that possible?
I really hope so!
Thanks!
Re: DLL change path
Posted: 24 Oct 2011, 11:44
by DllAdmin
Try to change the C:\map to . (dot only, nothing else) usually . (dot) means the current directory.
Try that and let us know if that worked.
C:\map => .
Re: DLL change path
Posted: 24 Oct 2011, 12:23
by Erjen
Thanks for your reply!
I changed it but it doesn't point to the current directory.
It points to:
C:\Windows\SysWOW64\inetsrv\
Do you know how to solve this?
Thanks again!
Re: DLL change path
Posted: 24 Oct 2011, 12:55
by Erjen
And maybe this helps you a little:
private void InitialiseCatalogName()
{
string filename = Path.Combine(".", "settings.xml");
XmlDocument document = new XmlDocument();
document = this.Load(filename);
XmlNode node = document.SelectSingleNode(this.GetXmlLocationCatalogName());
if (node == null)
Thats the piece of code and as you can see I replaced C:\map with the dot.
Re: DLL change path
Posted: 24 Oct 2011, 13:14
by DllAdmin
Try this in
string filename = Path.Combine(Environment.CurrentDirectory, "settings.xml");
Re: DLL change path
Posted: 24 Oct 2011, 13:42
by Erjen
Pfft now it proudly points to
'C:\Windows\SysWOW64\inetsrv\Environment.CurrentDirectory\settings.xml'
Unbelievable right.
I did exactly what you said:
string filename = Path.Combine("Environment.CurrentDirectory", "settings.xml");
Are there any other options or am I still doing something wrong?
Thank you very much again for your reply!
Re: DLL change path
Posted: 24 Oct 2011, 13:45
by DllAdmin
Hi again,
Do not put quotes in Environment.CurrentDirectory , this is the Environment variable, there is no need for " " (quotes) around that!
Just copy and paste it like this:
Path.Combine(Environment.CurrentDirectory, "settings.xml");
Re: DLL change path
Posted: 24 Oct 2011, 15:21
by Erjen
I am trying to remove them but with Reflexil it’s impossible. And the dll file is compiled so when I decompile it with Visual Studio and the Reflector plug-in, I can change it like you said but impossible to compile again I think.
Are you sure that the problem is the quotes? Because if that’s what you think it is I will do everything to remove them.
Thank you very much again! I appreciate your replies
Re: DLL change path
Posted: 24 Oct 2011, 15:28
by DllAdmin
I think the problem is in the quotes because if you put a string in quotes that means that the path is that one in between quotes.
But what you need to do is add a variable instead of string. The variable Environment.CurrentDirectory is the dynamic variable for the current directory (obviously). If you can make it work without the quotes that I think would be a solution.
You can also try to leave the path empty like this "" but I doubt this will work.
Re: DLL change path
Posted: 25 Oct 2011, 15:31
by Erjen
I changed it but didn't work either
I solved it now but used a workaround.
Thanks for all your replies and your help!!
Re: DLL change path
Posted: 27 Oct 2011, 11:48
by DllAdmin
Hi Erjen,
It would be the best if you could tell what was the workaround! Other people might find it useful.
Thanks.
Re: DLL change path
Posted: 13 Nov 2020, 16:59
by ExtraCoder
Erjen wrote:
> I am trying to remove them but with Reflexil it’s impossible. And the dll
> file is compiled so when I decompile it with Visual Studio and the
> Reflector plug-in, I can change it like you said but impossible to compile
> again I think.
Usually DLLs that I decompile with
http://Decompiler.com/ are compilable back. This decompiler produces a project structure that can be then imported into any IDE.
Re: DLL change path
Posted: 03 Dec 2020, 12:01
by Mohitvermaji51
Go to project properties (Alt+F7)
Under Debugging, look to the right
There's an Environment field.
Add your relative path there (relative to vcproj folder) i.e. ..\some-framework\lib by appending PATH=%PATH%;$(ProjectDir)\some-framework\lib or prepending to the path PATH=C:\some-framework\lib;%PATH%
Hit F5 (debug) again and it should work.
Re: DLL change path
Posted: 14 Jun 2021, 11:10
by paulritik_09
Once it's in a path directory, use the where command to verify windows can find the right one.But downloading random dll files and letting your programs load them is usually a bad idea.
In your Project properties(Right click on project, click on property button) ▶ Configuration Properties ▶ Build Events ▶ Post Build Events ▶ Command Line. Edit and add one instruction to command line. for example copy botan. dll from source path to location where is being executed the program.
Re: DLL change path
Posted: 27 Oct 2021, 17:54
by bezjosh99
your relative path there (relative to vcproj folder) i.e. ..\some-framework\lib by appending PATH=%PATH%;$(ProjectDir)\some-framework\lib or prepending to the path PATH=C:\some-framework\lib;%PATH%