Code dotnet Windows and cross-platform apps with just a text editor?

geronimus 41 Reputation points
2022-03-12T11:46:36.663+00:00

I am very interested in using .NET to develop desktop GUI apps for Windows, and possibly cross-platform versions.

However, what always stops me is Visual Studio. Yes, I know there's a community edition, and a subscription model. Price point isn't the problem anymore. And I realize that VS is a magnificent tool. And that Microsoft wants us to use VS because they want the development experience to be delightful. But that isn't what I'm resisting...

I don't want an IDE because it stops me from learning. Yes, Modern IDEs are magic! But that's exactly the problem.

Autocompletion allows you to learn an API by guesswork. But I prefer the APIs I use to be fully and explicitly documented. I want to read, understand, and be certain. Not just guess using intellisense, type hints, and the debugger.

When an IDE is responsible for compiling, testing, and packaging my code, it usually hides exactly what it's doing under the hood. Which executables are being run, with which arguments, and in what sequence? Which config files - that I've never even heard of - need to be just so for the whole thing to work?

Instead, I find myself blindly following tutorials, not knowing whether putting this file in that location is an essential convention of the platform, a convenient default, or just one particular teacher's personal preference.

But all of the tutorials and Getting Started docs for Windows app development place Visual Studio as the bar to entry. Whereas the best courses for understanding C++, Java, Javascript, Scala, Clojure, and even the ubiquitous Python, all boil it down to just a text editor like vi, a compiler, a build tool, and perhaps some libraries and utilities. You don't end up making an apple pie from scratch by first creating the universe, but you do learn the minimum necessary conditions for a program to work. And then you build on that.

So my question is:

Are there any resources - online docs or tutorials, books, videos, or classes - on building Windows / .NET MAUI apps from scratch, at the command line, without an IDE?

(And VSCode has added so many features that - for all practical purposes - I now consider it an IDE.)

Many thanks!

Community Center | Not monitored
{count} votes

Accepted answer
  1. MotoX80 36,401 Reputation points
    2022-03-14T21:44:25.617+00:00

    You could always use the VB (vbc.exe) or C# (csc.exe) command line compilers that come with the DotNet framework.

    https://www.bing.com/search?q=how%20to%20compile%20program%20with%20csc.exe

    I would recommend using Notepad++ as a text editor.

    C:\Windows>dir csc.exe /b /s
    C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe
    C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe
    C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe
    C:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe
    
    C:\Windows>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /?
    Microsoft (R) Visual C# Compiler version 4.8.4161.0
    for C# 5
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
    
                            Visual C# Compiler Options
    
                            - OUTPUT FILES -
    /out:<file>                    Specify output file name (default: base name of file with main class or first file)
    /target:exe                    Build a console executable (default) (Short form: /t:exe)
    /target:winexe                 Build a Windows executable (Short form: /t:winexe)
    /target:library                Build a library (Short form: /t:library)
    /target:module                 Build a module that can be added to another assembly (Short form: /t:module)
    /target:appcontainerexe        Build an Appcontainer executable (Short form: /t:appcontainerexe)
    /target:winmdobj               Build a Windows Runtime intermediate file that is consumed by WinMDExp (Short form: /t:winmdobj)
    /doc:<file>                    XML Documentation file to generate
    /platform:<string>             Limit which platforms this code can run on: x86, Itanium, x64, arm, anycpu32bitpreferred, or anycpu. The default is anycpu.
    
                            - INPUT FILES -
    /recurse:<wildcard>            Include all files in the current directory and subdirectories according to the wildcard specifications
    /reference:<alias>=<file>      Reference metadata from the specified assembly file using the given alias (Short form: /r)
    /reference:<file list>         Reference metadata from the specified assembly files (Short form: /r)
    /addmodule:<file list>         Link the specified modules into this assembly
    /link:<file list>              Embed metadata from the specified interop assembly files (Short form: /l)
    
                            - RESOURCES -
    /win32res:<file>               Specify a Win32 resource file (.res)
    /win32icon:<file>              Use this icon for the output
    /win32manifest:<file>          Specify a Win32 manifest file (.xml)
    /nowin32manifest               Do not include the default Win32 manifest
    /resource:<resinfo>            Embed the specified resource (Short form: /res)
    /linkresource:<resinfo>        Link the specified resource to this assembly (Short form: /linkres)
                                   Where the resinfo format is <file>[,<string name>[,public|private]]
    
                            - CODE GENERATION -
    /debug[+|-]                    Emit debugging information
    /debug:{full|pdbonly}          Specify debugging type ('full' is default, and enables attaching a debugger to a running program)
    /optimize[+|-]                 Enable optimizations (Short form: /o)
    
                            - ERRORS AND WARNINGS -
    /warnaserror[+|-]              Report all warnings as errors
    /warnaserror[+|-]:<warn list>  Report specific warnings as errors
    /warn:<n>                      Set warning level (0-4) (Short form: /w)
    /nowarn:<warn list>            Disable specific warning messages
    
                            - LANGUAGE -
    /checked[+|-]                  Generate overflow checks
    /unsafe[+|-]                   Allow 'unsafe' code
    /define:<symbol list>          Define conditional compilation symbol(s) (Short form: /d)
    /langversion:<string>          Specify language version mode: ISO-1, ISO-2, 3, 4, 5, or Default
    
                            - SECURITY -
    /delaysign[+|-]                Delay-sign the assembly using only the public portion of the strong name key
    /keyfile:<file>                Specify a strong name key file
    /keycontainer:<string>         Specify a strong name key container
    /highentropyva[+|-]            Enable high-entropy ASLR
    /enforcecodeintegrity[+|-]     Enforce code intergrity checks on all inputs to the compiler and enable loading compiled assemblies by other programs that enforce code integrity if the operating system is configured to do so.
    
                            - MISCELLANEOUS -
    @<file>                        Read response file for more options
    /help                          Display this usage message (Short form: /?)
    /nologo                        Suppress compiler copyright message
    /noconfig                      Do not auto include CSC.RSP file
    
                            - ADVANCED -
    /baseaddress:<address>         Base address for the library to be built
    /bugreport:<file>              Create a 'Bug Report' file
    /codepage:<n>                  Specify the codepage to use when opening source files
    /utf8output                    Output compiler messages in UTF-8 encoding
    /main:<type>                   Specify the type that contains the entry point (ignore all other possible entry points) (Short form: /m)
    /fullpaths                     Compiler generates fully qualified paths
    /filealign:<n>                 Specify the alignment used for output file sections
    /pdb:<file>                    Specify debug information file name (default: output file name with .pdb extension)
    /errorendlocation              Output line and column of the end location of each error
    /preferreduilang               Specify the preferred output language name.
    /nostdlib[+|-]                 Do not reference standard library (mscorlib.dll)
    /subsystemversion:<string>     Specify subsystem version of this assembly
    /lib:<file list>               Specify additional directories to search in for references
    /errorreport:<string>          Specify how to handle internal compiler errors: prompt, send, queue, or none. The default is queue.
    /appconfig:<file>              Specify an application configuration file containing assembly binding settings
    /moduleassemblyname:<string>   Name of the assembly which this module will be a part of
    
    
    C:\Windows>
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.