简体   繁体   English

如何在C#中从Windows窗体应用程序项目设置.dll文件的路径?

[英]How to set path of .dll file from windows form application project in C#?

I'm making a Windows Form project in MS Visual Studio 2012 and using an external .dll file. 我在MS Visual Studio 2012中制作一个Windows Form项目,并使用一个外部.dll文件。 However, to use the functions of that file, i need to set the path of that .dll file in Environment Variables PATH option manually. 但是,要使用该文件的功能,我需要在“环境变量PATH”选项中手动设置该.dll文件的路径。

My Computer -> Properties -> Advance System Settings -> Environment Variables -> PATH 我的电脑->属性->高级系统设置->环境变量-> PATH

Can i do something in my code that when i give someone the generated .exe setup file of my application alongwith .dll file, my application automatically sets the path of .dll file from application directory? 我可以在代码中做一些事情,当我将应用程序的生成的.exe设置文件与.dll文件一起交给某人时,我的应用程序自动设置应用程序目录中.dll文件的路径吗?

If this question is repeated, kindly provide me with the link for my answer. 如果这个问题重复出现,请提供我的答案链接。

您可以使用Environment.SetEnvironmentVariable从c#代码设置环境变量。在这里看看: C#设置环境变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从C#windows应用程序项目调用C ++ DLL - how to call a C++ dll from C# windows application project 如何从c#中的windows表单应用程序中读取xml文件 - How to read xml file from windows form application in c# 如何在不实际知道C#Windows应用程序窗体目录中的完整路径文件的情况下自动查找文件 - How to find a file automatically without actually knowing the full path file in directory in C# windows application Form 如何在C#中将WPF窗体设置为Windows窗体应用程序主窗体 - how to set wpf form as windows form application mainform in c# 如何将C .DLL文件导入C#Windows窗体应用程序并调用其在标头中定义的函数? - how do you import a C .DLL file to a C# windows form application and call its functions that are defined in headers? C#-如何在DLL中打开Windows窗体 - C# - How to open a Windows Form in DLL 如何在C#Windows窗体项目中设置应用程序关闭模式? - How to Set Application Shutdown Mode in a C# Windows Forms Project? 如何在C#应用程序中设置TNSNAMES文件的正确路径? - How to set proper path to TNSNAMES file in C# application? c#如何将pdf文件包含到我的Windows窗体应用程序中 - c# how to inclued a pdf file to my windows form application 如何从C#Windows应用程序中的运行模式识别表单设计器文件? - How to Identify form designer file from running mode in C# windows application ?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM