|
Pete O'Hanlon wrote: how are you going to share your reusable code?
The same way, but as an EXE with some sort of helpful library-specific functionality in the main . :shrug:
|
|
|
|
|
Why would you want to make your code monolithic by including it in larger .EXE's, thereby increasing load time?
Why would you want to give the users the ability to launch a "library" .EXE that does nothing but return to the command prompt?
|
|
|
|
|
Dave Kreskowiak wrote: make your code monolithic by including it in larger .EXE's
That's not what he means.
|
|
|
|
|
I know.
I was just pointing out that some people can go overboard with the ILMerge tool and end up making an .EXE that's 10's or 100's of MB in size. Then they wonder why it takes so long to load.
|
|
|
|
|
+5
"Let's make a shared library out of that code"
"Lets us ILMerge those"
It is also done on the web, where they call it "packaging" or something like it. I wonder how many sites made me download a JQuery library that's already cached in the browser.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Oh, you've done SSIS too?
|
|
|
|
|
I wouldn't want to do either and nothing about my question implies I would.
|
|
|
|
|
By wrapping everything in an executable you're just adding extra dead weight.
|
|
|
|
|
Do you know how much and if so is it a constant amount?
|
|
|
|
|
It's not constant as the sizes of various tables in the resulting .EXE change depending on what is in the .EXE.
|
|
|
|
|
A single static method. How much do they weigh?
..and now in metric?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It's the startup code, import tables, data tables, blah, blah, blah for a Win32 executable, that a .DLL doesn't have, nor need. A .NET assembly in an .EXE is not 100% MSIL code. There is still unmanaged code in there to get the process running under the CLR.
|
|
|
|
|
Dave Kreskowiak wrote: There is still unmanaged code in there to get the process running under the CLR
I'd be (at least a little) surprised if that got loaded with the Assembly when referenced in the usual way -- it ought to only affect disk usage except when executed (but then we're talking about Microsoft).
|
|
|
|
|
I just made a rough measure of this empirically:
1 class and 1 method DLL in release mode (4k on disk) vs EXE (5k on disk)
10 classes with 10 methods each in release mode gave DLL (7k on disk) and EXE (8k on disk)
So the bloat increases far less than I'd consider to be significant.
As for process start and CLR load.... remember we are just loading a library into an existing running CLR.
|
|
|
|
|
I think Dave is also concerned about size in memory (when referenced normally), which is harder to measure.
|
|
|
|
|
Yeah, you're looking at disk usage, not in memory.
If you want an idea of what overhead you're including, look at the Imports table in the .EXE.
|
|
|
|
|
I've now done the same using perfmon and don't see a significant overhead after taking the difference in process memory size.
Can you point to more information on this subject?
|
|
|
|
|
Windows Internals 6th Edition, Part 1 and 2.
Perfmon will only tell you exactly what you're telling it to, and only if the data is interpreted correctly.
|
|
|
|
|
In a sense there is little difference between dlls and exes from the .NET perspective. I sometimes make code that is designed to be consumed by something (so would normally be a DLL) an .exe to support stand-alone use etc.
My main point would be that they are conceptually different things. One is an application, the other is a reusable library. In a normal .NET deployment all your assemblies end up deployed in the same folder. Would you really want 20 .exes which don't do anything when you run them?
It is a useful semantic distinction.
Regards,
Rob Philpott.
|
|
|
|
|
Well, in .Net it is called an assembly, but for your question it has the same function as a DLL or static library in Win32.
An executable is usually a front end that the user executes and it can show a graphical user interface (GUI), a command line console interface or a web interface. An assembly is loaded into memory at run time and used by the executing application.
What you want to achieve with a library/assembly is to compile code that is used over and over again into reusable modules. Look at all the references you add to your exe, they all contain code other people have written and you can reuse.
Another way to reuse is to have compile the source code of the reusable classes into your exe, but that means that you need to have all source code available at all times.
It means that every compilation might give you a slightly different functionality if you share code and someone make some changes in a class. If you use a specific version of an assembly you are pretty sure that you get what you wanted (assuming versions are used)
This was a short explanation that could be much longer, and as an end note I boil it down to this:
1. No DLL's or assemblies are not obsolete.
2. Reuseability is the biggest advantage as I see it.
|
|
|
|
|
Hello,
I have a dropdownlist.
I and binding data to this dropdownlist in page load as below:
Module module = new Module();
lstModule = module.GetModules();
((DropDownList)fvReport.FindControl("ddlModuleID")).DataSource = lstModule;
((DropDownList)fvReport.FindControl("ddlModuleID")).DataTextField = "ModuleName";
((DropDownList)fvReport.FindControl("ddlModuleID")).DataValueField = "ModuleID";
((DropDownList)fvReport.FindControl("ddlModuleID")).DataBind();
((DropDownList)fvReport.FindControl("ddlModuleID")).Items.Insert(0, new ListItem() { Text = "Select", Value = "0" });
now I am into edit mode using formview. I have show the current selected value in this dropdown.
so I loading data and binding data source to it as below:
it is having ModuleID as field in the datasource.
<blockquote class="quote"><div class="op">Quote:</div>List<report> lstReport = new List<report>();
Report report = new Report();
report.ReportId = FormatNumValues.GetNullInt(hdnReportID.Value);
lstReport = report.GetReports();
fvReport.DataSource = lstReport;
fvReport.DataBind();</blockquote>
and on aspx page, doing as below:
<blockquote class="quote"><div class="op">Quote:</div> <asp:dropdownlist id="ddlModuleID" runat="server" width="80px" selectedvalue="<%# Eval("ModuleID") %>">
</blockquote>
When I execute the page, the dropdown list goes blank without any data.
Where am I going wrong?
|
|
|
|
|
Greetings.
I have a library written in C# 2.0 which will soon be re-released with minor documentation changes. The library was originally developed using VS 2005; I am now using VS 2013.
Given that programs which use the library could be written in any version of C#, and that I wish to make using the library as convenient as reasonably possible, should I re-release the compiled library only in C# 2.0 or a combination of versions?
I understand that C# 2.0, 3.0 and 3.5 use the same version of the CLR, whereas C# 4.x uses a newer version. I've read that mixing pre 4.0 libraries and 4.x applications might be an issue. Would the best option then be to release versions compiled with C# 2.0 and 4.0 ?
There is no plan to update the code in the library to use newer (> 2.0) C# language features.
Note that I have found related discussions on StackOverflow, but nothing which directly addresses the issue of releasing multiple versions of compiled libraries for different versions of .NET.
Thanks everyone in advance for their insight and suggestions!
Graham
|
|
|
|
|
If you do not change code, do not change .NET Framework version...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Stay with .Net framework 2, but tell users of your library who wish to use more recent versions of the framework that they may need to add an entry in app.config:
<startup useLegacyV2RuntimeActivationPolicy="true" />
|
|
|
|
|
Graham Wilson wrote: Given that programs which use the library could be written in any version of C#,
But will they? The answer to that should drive both your decision.
And naturally you should also make an attempt to test it with newer versions.
|
|
|
|