使用十年的电脑在家用记事本调试 .NET 程序

引言

春节放假回老家,没有把笔记本电脑带上,由于肺炎疫情的原因只能呆在家里,写的一个WinForm程序无法正常使用,需要及时修复,看我如何使用家里十年的台式机来调试修复 .NET 应用程序。

WinForm程序无法正常使用的原因,主要是在解析html源代码的时候,找不到指定的节点导致的错误。

开发环境

  • CPU:Pentium(R) Dual-Core CPU E6300 @ 2.80GHz
  • 内存:2G
  • 系统:Windows 7 家庭普通版

配置

开发工具

尝试安装vs code软件,发现安装完成运行后,打开界面一直处于黑屏状态,电脑非常卡,只能使用Notepad++记事本修改代码。

  • MSBuild
  • Notepad++

MSBuild 2015工具下载地址:

https://www.microsoft.com/zh-CN/download/confirmation.aspx?id=48159

在安装MSBuild的时候,需要先安装.net framework 4.5框架。

MSBuild

安装完成后,需要将目录添加到环境变量,我安装后的目录为:C:\Program Files\MSBuild\14.0\Bin

如何将目录添加到环境变量略。

编译运行

首先,将源代码从github上面下载到本地,解压即可,如下图:

MSBuild 文档地址:

https://docs.microsoft.com/zh-cn/visualstudio/msbuild/msbuild

尝试编译,代码如下:

MSBuild.exe itsvse.csproj -property:Configuration=Debug

报错如下:

“C:\Users\pi\Downloads\itsvse\itsvse\itsvse.csproj”(默认
目标)
(1) ->
(CoreCompile 目标) ->
  Form1.cs(13,7): error CS0246: The type or namespace name 'CsharpHttpHelper' c
ould not be found (are you missing a using directive or an assembly reference?)
 [C:\Users\pi\Downloads\itsvse\itsvse\itsvse.csproj]
  Form1.cs(14,7): error CS0246: The type or namespace name 'Newtonsoft' could n
ot be found (are you missing a using directive or an assembly reference?) [C:\U
sers\pi\Downloads\itsvse\itsvse\itsvse.csproj]

    6 个警告
    2 个错误

已用时间 00:00:05.28

解决方案,将程序引用的 dll 复制到 /bin/Debug 文件夹下面,重新编译即可,如下图:

可以正常打开编译后应用程序,然后通过写日志的方式一点点调试输出,使用Notepad++记事本修改代码,重新编译程序,WinForm 程序即可正常运行。

原文地址:https://down.itsvse.com/k/0nomps.html

posted @ 2020-01-29 20:55  _小渣渣  阅读(789)  评论(0编辑  收藏  举报