|
Thanks for that Shaun. Its a little clearer now.
|
|
|
|
|
IrvTheSwirv wrote:
If you follow the above points, assuming your "usings" are correct too your app will build and assuming the path to the dynamically loading assembly is correct the whole thing will work. (Don't forget to test for a "FileNotFoundException")...
I got a question on this issue. Say my EXE looking for the DLL's. They are properly referenced in the project, what if the DLL's (assemblies) are missing physically at runtime. What's the order of searching for this assemblies? ex: search in local directory, if not search in the GAC....
"FYIFV"
Pin made and worn by many Microsoft employees after the company went public. It means, "F*ck You I'm Fully Vested" This signature was created by "Code Project Quoter".
|
|
|
|
|
Here's the answer to that one... from the .NET SDK
You can make a dynamic reference to an assembly by providing the calling method with only partial information about the assembly, such as specifying only the assembly name. In this case, only the application directory is searched for the assembly, and no other checking occurs. You make a partial reference using any of the various methods for loading assemblies such as System.Reflection.Assembly.Load or AppDomain.Load . If you want the runtime to check the global assembly cache as well as the application directory for a referenced assembly, you can specify a partial reference using the System.Reflection.Assembly.LoadWithPartialName method.
So as usual, it depends!
Cheers
Shaun
|
|
|
|
|
Thx Shaun.
If I want to check for the assemblies in my code, where I have to keep the code?
If the assemblies are missing, I want the app to end gracefully instead of crash. BTW, Any code snippet for this?
I want to do like this:
Retrieve all the assemblies the EXE requires.
Find the assemblies in local directory.
If they are not there, then show a error and end the app.
Never take a problem to your boss unless you have a solution. This signature was created by "Code Project Quoter".
|
|
|
|
|
IMHO i think a better approach would be to just handle the FileNotFoundException when you dynamically load the assemblies... but obviously you might know of a good reason to implement what you are describing!
|
|
|
|
|
IrvTheSwirv wrote:
i think a better approach would be to just handle the FileNotFoundException when you dynamically load the assemblies...
Thx Shaun.
Let me ask the question again..
I don't want to dynamically load the assemblies.
When the EXE tries to load the private assemblies (the DLL's EXE requires), if that assembly is not found it will throw the "FileNotFoundException" (Just-In-Time dialog) to the user.
Instead of that dialog, I want to catch that exception and display my version of error message and end the application gracefully.
Now where should I catch that exception?
Never take a problem to your boss unless you have a solution. This signature was created by "Code Project Quoter".
|
|
|
|
|
Many Many Apologies Kant...
I was getting tied up with the other issues in this thread as there seems to be a double stream to it... now that I've re-read I can answer your quezzie!!
The exception will be thrown the first time the type in the DLL is requested by the EXE as the runtime will attempt to load the assembly and create the object.
What I would do is either find the point in the execution where the types are first loaded and wrap that in the old try catches
OR
do a quick instantiation of a known class, wrapping it in a try catch for each of the DLLs..
OR
create a simple class in each assembly (maybe with a simple static call) and try to call it...
OR if none of those are suitable...
You could add entries into your App.Config file which lists the dlls you require to exist in your app folder and just do a DirectorySearch...
I Dunno... it's tricky!!
Shaun
|
|
|
|
|
IrvTheSwirv wrote:
What I would do is either find the point in the execution where the types are first loaded and wrap that in the old try catches
That happens at this point.
Application.Run(new Form1()) in Main().
Thanks Shaun, those were excellent suggestions.
Never take a problem to your boss unless you have a solution. This signature was created by "Code Project Quoter".
|
|
|
|
|
I already did like this to retrieve the modules needed by app. I was shocked know that it loads 94 DLL's...
ArrayList arrayList = new ArrayList();<br />
<br />
foreach (ProcessModule module in Process.GetCurrentProcess().Modules) <br />
{<br />
arrayList.Add(module);<br />
Debug.WriteLine(module.FileName);<br />
}
From this 95 DLL's, I want to know about 2 DLL's (assemblies) only. (Shown as Bold in the following list) How to do that?
C:\Code Project Quoter\CodeProjectQuoter\bin\Debug\CodeProjectQuoter.exe
C:\WINDOWS\System32\ntdll.dll
C:\WINDOWS\system32\mscoree.dll
C:\WINDOWS\system32\KERNEL32.dll
C:\WINDOWS\system32\ADVAPI32.dll
C:\WINDOWS\system32\RPCRT4.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\mscorwks.dll
C:\WINDOWS\system32\USER32.dll
C:\WINDOWS\system32\GDI32.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\MSVCR70.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\fusion.dll
C:\WINDOWS\system32\SHELL32.dll
C:\WINDOWS\system32\msvcrt.dll
C:\WINDOWS\system32\SHLWAPI.dll
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
C:\WINDOWS\system32\comctl32.dll
c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll
C:\WINDOWS\system32\ole32.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\diasymreader.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\mscorsn.dll
C:\WINDOWS\System32\uxtheme.dll
C:\Program Files\Avant Browser\SysHook.dll
C:\WINDOWS\system32\oleaut32.dll
C:\WINDOWS\System32\SynTPFcs.dll
C:\WINDOWS\system32\VERSION.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\MSCORJIT.DLL
c:\windows\assembly\gac\system.windows.forms\1.0.3300.0__b77a5c561934e089\system.windows.forms.dll
c:\windows\assembly\gac\system\1.0.3300.0__b77a5c561934e089\system.dll
c:\windows\assembly\gac\system.drawing\1.0.3300.0__b03f5f7f11d50a3a\system.drawing.dll
C:\WINDOWS\System32\netfxperf.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\perfcounter.dll
c:\windows\assembly\gac\system.xml\1.0.3300.0__b77a5c561934e089\system.xml.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\CorperfmonExt.dll
C:\WINDOWS\System32\PSAPI.dll
C:\WINDOWS\System32\aspperf.dll
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\aspnet_isapi.dll
C:\WINDOWS\System32\query.dll
C:\WINDOWS\System32\infoctrs.dll
C:\WINDOWS\System32\INFOADMN.dll
C:\WINDOWS\System32\IisRTL.DLL
C:\WINDOWS\System32\WS2_32.dll
C:\WINDOWS\System32\WS2HELP.dll
C:\PROGRA~1\MI6841~1\MSSQL$~1\Binn\sqlctr80.dll
C:\PROGRA~1\MI6841~1\MSSQL$~2\Binn\sqlctr80.dll
C:\PROGRA~1\MI6841~1\MSSQL\BINN\SQLCTR80.DLL
C:\WINDOWS\System32\snprfdll.DLL
C:\WINDOWS\System32\STAXMEM.dll
C:\WINDOWS\System32\perfdisk.dll
C:\WINDOWS\System32\perfnet.dll
C:\WINDOWS\System32\NetApi32.Dll
C:\WINDOWS\System32\perfos.dll
C:\WINDOWS\System32\perfproc.dll
C:\WINDOWS\System32\rasctrs.dll
C:\WINDOWS\System32\rasman.dll
C:\WINDOWS\System32\rsvpperf.dll
C:\WINDOWS\System32\smtpctrs.DLL
C:\WINDOWS\System32\SMTPAPI.dll
C:\WINDOWS\System32\winspool.drv
C:\WINDOWS\System32\tapiperf.dll
C:\WINDOWS\System32\tapi32.dll
C:\WINDOWS\System32\rtutils.dll
C:\WINDOWS\System32\WINMM.dll
C:\WINDOWS\System32\Secur32.dll
C:\WINDOWS\System32\Perfctrs.dll
C:\WINDOWS\System32\iphlpapi.dll
C:\WINDOWS\System32\MPRAPI.dll
C:\WINDOWS\System32\ACTIVEDS.dll
C:\WINDOWS\System32\adsldpc.dll
C:\WINDOWS\system32\WLDAP32.dll
C:\WINDOWS\System32\ATL.DLL
C:\WINDOWS\System32\SAMLIB.dll
C:\WINDOWS\System32\SETUPAPI.dll
C:\WINDOWS\System32\perfts.dll
C:\WINDOWS\System32\WINSTA.dll
C:\WINDOWS\System32\UTILDLL.dll
C:\WINDOWS\System32\w3ctrs.dll
C:\WINDOWS\System32\wbem\wmiaprpl.dll
C:\WINDOWS\System32\loadperf.dll
C:\WINDOWS\System32\wbem\wbemcomn.dll
C:\WINDOWS\System32\NTMARTA.DLL
c:\code project quoter\codeprojectquoter\bin\debug\quoteslibrary.dll
c:\code project quoter\codeprojectquoter\bin\debug\htmleditor.dll
c:\windows\assembly\gac\microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\microsoft.mshtml.dll
c:\windows\assembly\gac\accessibility\1.0.3300.0__b03f5f7f11d50a3a\accessibility.dll
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.10.0_x-ww_712befd8\gdiplus.dll
C:\WINDOWS\System32\CLBCATQ.DLL
C:\WINDOWS\System32\COMRes.dll
C:\WINDOWS\System32\mshtml.dll
C:\WINDOWS\system32\URLMON.DLL
C:\WINDOWS\System32\mlang.dll
C:\WINDOWS\System32\msimtf.dll
C:\WINDOWS\System32\MSCTF.dll
C:\WINDOWS\system32\WININET.dll
C:\WINDOWS\system32\CRYPT32.dll
C:\WINDOWS\system32\MSASN1.dll
Never take a problem to your boss unless you have a solution. This signature was created by "Code Project Quoter".
|
|
|
|
|
Hello All,
I was wondering if there is an easy way to create the event handlers for objects. I know that simply clicking on them brings up their default event handler, such as Form_Load. Is there a way to do this for say, right_click, or any of the other events of any object through the ide? Rather than just typing it in.
Thanks,
Ryan
|
|
|
|
|
Perhaps you have missed to look the VS.NET events.
open up your project in VS.NET 2002/3
click F4 or Click "View" -> Properties Window"
now go click any UI,
and click on any Control of your wish
In properties window you will see lightning bolt (2n'd after A-Z sorting order)
click there on Lightning bolt which is event and its the destination of all events
Paresh
|
|
|
|
|
|
I have Master-Detail datagrid. The detail datagrid is embedded in the Master datagrid. In the detail datagrid I want to implement paging ,sorting etc. I have addes the event handlers delegates manually. For some reason the pageindexchanged or sort events for the detail datagrid. Does anyone know of this behaviour? I saw a lot Master-Details datagrids on the internet, nobody seems to have implemented paging-sorting for details grid embedded within a datagrid. thanks
Madhuri Mittal
|
|
|
|
|
have you seen the initial MSDN Datagrid sample, its parent->child relation ship of tables based datagrid
so if you click on + sign you get the detail(child)datagrid.
well its actually one grid only.
but reffer to
Datagrid Question And Answers
Paresh
|
|
|
|
|
How can I host an Internet Explorer window inside of a windows form?
Like what the autocad installer is like....
/\ |_ E X E GG
|
|
|
|
|
right click on your toolbox then add a control , select microsoft webbrowser control, double click to add to form.
switch(twinsOnWay)
{
case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
break;
|
|
|
|
|
Now... what is the aspx code to launch an executable from that webpage, inside of that windows form?
/\ |_ E X E GG
|
|
|
|
|
I've included an XML File into my project. In a class I open this file with the following FilePath:"..\\..\\XmlFile.xml". That's right because the application folder is the bin\debug folder but the Xml File is in the project folder.
But what is if I want to install my project? Then the Xml File will be in the application folder but in my class the folder stays "..\\..\\XmlFile.xml" so the file won't be found.
I hope that there is another possibily than to copy each time I compile und start the App. the XmlFile into the debug folder and change the FilePath in the class to "XmlFile.xml" to be sure to have the actual file version, right?
How can I resolve this FilePath Problem?
In VC++ as I remember it was possible to define debug/release preprocessor derictives to solve such problems. But how in C#?
Thanks
Stefan
|
|
|
|
|
STW wrote:
In a class I open this file with the following FilePath:"..\\..\\XmlFile.xml".
Instead of using that way, why don't you the keep file in the bin\debug.
The better way is select the file via OpenFileDialog .
Use the FileInfo class so that you can check that file exist or not.
FileInfo fileInfo = new FileInfo(fileName);<br />
if(fileInfo.Exists)<br />
{<br />
..<br />
}
STW wrote:
But what is if I want to install my project? Then the Xml File will be in the application folder but in my class the folder stays "..\\..\\XmlFile.xml" so the file won't be found.
If you have already got the Deployment project in your solution. Then just add the XML file to that project and make sure that the 'Folder' property of that file is set to "Application Folder". (Properties window)
Never take a problem to your boss unless you have a solution. This signature was created by "Code Project Quoter".
|
|
|
|
|
I am looking for a tutorial/code sample/etc that will provide the same toolbar functionality that is used in the VS .NET IDE.
This means that it must :
- Be draggable
- Be dockable
- Be able to hold different components (i.e. combo boxes)
- Be able to do drop down menus.
Does anybody have any ideas where I can find this, lots of hunting around turns up code samples that do 1 or 2 of the features I need but not all of them.
Thanks in advance
M
|
|
|
|
|
Sorry, don't know of a good one yet. I'm writing a commandbar which will likely be in the CP2 GUI Library.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
oh,
the signature is cool
You are the best!Me too!
|
|
|
|
|
Thanks!
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
After much hunting yesterday I finally decided to use the following toolbar :
http://www.aisto.com/roeder/dotnet/ (CommandBar for .NET)
It doesnt have all the functionality that I would have liked but I will make do.
This is what the following article is based on :
http://www.codeproject.com/cs/menu/vsnettoolbar.asp
But <sarcasm>unfortunatly Carlos H. Perez has sold out and gone commercial with his code - which is odd considering that is based on somebody elses code and this fact isnt mentioned anywhere on his site, ho humm.
Human Nature + Open Source = error cannot compute
|
|
|
|
|
I intend to tweak Roeders code to meet my needs
When / If I accomplish this I will probably make an article about it
|
|
|
|