Results 1 to 12 of 12

Thread: General question about .net and dependencies

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    10

    General question about .net and dependencies

    So I'm fairly new to .net (several years of MS Access VBA before that), and have managed to program a couple of Windows Forms that log into SQL Server databases and do various things. I felt they were a good start to my programming in vb.net. They're not amazingly complex, but they do what they're designed to.

    I have a coder in my department (duties are not well defined; I have many tech support duties that he does not, but he's got quite a bit more programming experience than me). Today, as I started to program a 3rd vb.net app, that said "you know, your .exe files shouldn't be requiring these other files; the things you're doing should be able to be done without producing extra required files. that's a bug, and you'll need to eventually figure out the problem." In creating the apps, I followed several tutorials on the net, so I know (or suspect) that vb.net's "Windows Forms Project" option just automatically creates the files it needs when creating an EXE. To me that seems industry standard. But he's talking like a good vb.net program shouldn't have any dependency files, and should just be an executable.

    Can someone with more experience in coding in vb.net give me some guidance as to whether either perspective has merit when it comes to how I should be designing applications?

    EDIT: The files I'm referring to are .pdb, .xml, .dll and .config.
    Last edited by Rando1000; Aug 1st, 2022 at 02:24 PM.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,066

    Re: General question about .net and dependencies

    This sounds like a publishing issue in that it sounds like you're deploying the contents of your bin directory rather than actually creating an installation. Is that safe to assume?
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    10

    Re: General question about .net and dependencies

    Quote Originally Posted by dday9 View Post
    This sounds like a publishing issue in that it sounds like you're deploying the contents of your bin directory rather than actually creating an installation. Is that safe to assume?
    Partially, perhaps. In VB 6 I remember creating installation files rather than copying out bin files, so if that means still exists, it would make the delivery a little more professional (even though these apps are internal to tech users, so it's not strictly necessary).

    But another side is that he literally expects there to be ONLY an exe file that he can link to and run, because that's how he programs. Like he should be able to copy an EXE off the drive, double click it, and run the program without the program needing ANY ancillary files. He doesn't seem to like it that my application relies on code generated by Microsoft that it is difficult to directly edit. I don't feel like an installable would solve that problem. I brought up that no modern software by any developer is just an EXE. like you can't just copy Excel.exe and expect Excel to run. His reply was "this isn't Excel."

  4. #4
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,080

    Re: General question about .net and dependencies

    Unfortunately, this sounds like the type of issue that can't be resolved by strangers on a forum. This person sounds like they have a massive attitude problem and also don't know what they are talking about, the combination of these two can be unbearable.

    I have no technological advice to give you, since there really is none to give in this case.

    I would be curious what programming language/compiler he uses.

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    10

    Re: General question about .net and dependencies

    He uses C#, but has done most of his coding using SharpDevelop rather than Visual Studio. It should probably be noted that since he's worked for our company, he hasn't made very many GUI applications. He's done console apps that do text manipulation, as well as improved upon my VBA code in MS access, but maybe only one GUI app, which no one uses except himself on his computer.

    I was just looking to get a general sense that I'm not nuts. It is not unusual at all for modern GUI applications written in Visual Studio to have additional dependent files (whether delivered via installer or direct copy), is that correct? So the claim that having dependent files is a "bug" is not accurate. I'm not looking for an "I'm right" here, as clearly I have much to learn, but I can't even think of a VB 6 app I wrote where the installer didn't put something aside from an EXE on a hard drive.

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,066

    Re: General question about .net and dependencies

    Perhaps the easiest solution is to use the publishing wizard, but before that you should remove any unused references.

    Open the project's properties by going to Project > {Project Name} Properties, then go to the Reference tab, and then go through and prune any references you aren't using.

    After that, go to the Publish tab. Click on the Application files to make sure that your executable, the config, the manifest, and any 3rd party dependencies are a required download group. Then click on Prerequisites and select any prerequisite items. Then click on options and go through the description, deployment, manifests, and file associations and optionally fill out the fields.

    Finally, click on the publishing wizard. Select the location to publish the application to, most likely this will be a location on your local machine. Click next and then select the "From a CD-ROM or DVD-ROM" option. Click next and optionally configure the application for updates. Click on finish.

    This will create a setup.exe file. After the user runs the setup.exe file on their machine, it will create a shortcut in their "programs" directory and it can be uninstalled/modifed via the Apps & Features in the computer settings.
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    10

    Re: General question about .net and dependencies

    Quote Originally Posted by dday9 View Post
    Perhaps the easiest solution is to use the publishing wizard, but before that you should remove any unused references.
    Definitely good advice in any case. Thanks for the advice.

  8. #8
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,080

    Re: General question about .net and dependencies

    The .pdb, .config, .xml files that you referenced likely don't need to be distributed with the .exe file, they are probably just compilation cruft.

    If your program has references to other components that exist as .dll files, then those .dll files need to go with the .exe file. If you don't have references to other components that exist as .dll files, but .dll files are somehow ending up being placed into the compilation destination folder, then you would have to post more details about what those specific .dll files are to get more input on why that is happening.

    That said, it is entirely possible to write a VB.NET .NET Framework based program such that the only thing that needs to be distributed to other computers is the .exe file itself, provided that the destination computer has the proper version of the .NET Framework installed.

  9. #9
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,066

    Re: General question about .net and dependencies

    For what its worth, I work in C# too. As you may have noticed from your coworker, most programmers are very opinionated. My advice is two-fold, first use the right tool for the right job. Secondly, prioritize requests.

    If what you are doing is working for you and your client and you do not see any significant gains in changing your process, then phooey on your coworker.
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  10. #10
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,220

    Re: General question about .net and dependencies

    What exe files? Said the web developer.
    Anyhow I would be very curious when you co worker comes on dealing with JSON or QRCode programming or anything that deviates from standard flat line programming.
    Also one exe means he is hard coding database credentials inside it that in .net it's a peach to decode.If only an encrypted config file did exist...Hmm.
    So in general that statement is false.But you can always invite him here to debate.Would be nice to see a grown man cry.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    37,551

    Re: General question about .net and dependencies

    The first question I have is whether this is .NET Framework or....what's the actual name for the other thing? It was .Net Core, now it's .Net5 or .Net6, and those aren't quite Core, but are the successor to Core. Does that have a name?

    Most newer programs will be one of those newer (Core, 5, or 6) options. The idea behind those was to remove the dependency on the framework by including the pieces you need in the output. I'm still almost exclusively doing Framework stuff, so I'm not sure what outputs 5/6 would produce, though I think it would be a bunch of dlls.

    You won't need the .pdb or the .xml files. You might take a look at the .config file. Quite likely, you won't need that, either. As for the .dlls...you probably DO need those.
    My usual boring signature: Nothing

  12. #12
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    108,822

    Re: General question about .net and dependencies

    Quote Originally Posted by Rando1000 View Post
    In creating the apps, I followed several tutorials on the net, so I know (or suspect) that vb.net's "Windows Forms Project" option just automatically creates the files it needs when creating an EXE.
    If you're using VS 2022 or VS 2019 then the Windows Forms App project template will target .NET Core, which includes .NET 5 and later. All project templates that target .NET Framework will explicitly say so in the name, e.g. "Windows Forms App (.NET Framework)". That means that your first decision is whether to target .NET Core or .NET Framework. .NET Framework 4.8 will be supported for a while yet and gives the best experience for VB WinForms developers, but .NET Core is where all future development is going and will be all that is supported by Microsoft once .NET Framework 4.8 reaches end-of-life.

    .NET 5 was an evolution of .NET Core 3.1 but was considered a merger of that with .NET Framework 4.8, hence the version number going to 5. .NET 5 and later allow you to create an EXE that relies on an installed framework, as .NET Framework 4.8 and earlier did, plus it allows you to create an EXE that has all the required DLLs deployed with it, as .NET Core 3.1 did. If you have a simple EXE but also lots of DLLs then it sounds like you have created the latter type of project. If you are going to target .NET Core then you need to determine what type of project you need. If .NET Core will be installed on the target machine then it's the former, and you won't deploy any system DLLs with your EXE.

    All this holds for C# too, so the fact that your colleague couldn't explain it suggests that they may not know as much as they think they do. Similarly, C# projects also generate PDB, XML and CONFIG files. They have their uses but they are not required. In the case of the CONFIG file, it depends on whether you have stored any data there, including settings, connection strings or the like.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width