一个Txt文件,文件名为HelloWPF.txt,路径为F:\C#Code\WPF\20200830_TimLiu01
    文件内容为:

    1. namespace MyApp
    2. {
    3. class Program
    4. {
    5. static void Main(string[] args)
    6. {
    7. System.Windows.MessageBox.Show("Hello,WPF!");
    8. }
    9. }
    10. }

    在x64 Native Tools Command Prompt for VS 2019 C#编译器中执行
    cd F:\C#Code\WPF\20200830_TimLiu01
    f:
    dir

    csc /r:”C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client\PresentationFramework.dll” /t:exe HelloWPF.txt(将生成带控制台的exe)

    csc /r:”C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client\PresentationFramework.dll” /t:winexe HelloWPF.txt(将生成不带控制台的exe)

    image.png