Visual Studio 2022 模板的使用方法

在前面的文章,我们已经配置好Irvine32的各种库,并在Visual Studio 2022中进行了调试和使用,均可以正常输出结果。

那么 ,下一步,我们就以此为模板,创建可复用的带Irvine32配置的项目,这样就不用每次新建项目后,还要依照前述方法一步又一步地进行各个属性配置,太麻烦了,本次就使用模板,一次性创建好。具体如下:

将项目导出为模板(供以后复用)

步骤 1:确保项目能成功编译运行(前面文章已经测试过,可正常运行)

  • 先按 F5 或 Ctrl+F5 测试程序是否输出 "Hello, Irvine32!"

步骤 2:导出为项目模板

  1. 在 Visual Studio 中,点击顶部菜单:
    • 项目 (Project) → 导出模板 (Export Template...)
  2. 选择 项目模板 (Project template) → 点击 下一步
  3. 填写模板信息:
    • 模板名称 : Irvine32 Assembly Project
    • 模板说明 : A ready-to-use x86 assembly project with Irvine32 configured.
    • 图标和预览图像(可选):可留空
  4. 勾选 Automatically import the template into Visual Studio
  5. 点击 完成
  6. 在"解决方案"右击,添加"新建项目"

7、找到刚才定义好的模板文件

8、点击下下一步,出现如下界面:

按照你自己的项目要求,填写"项目名称"就可以了。

这样创建之后的项目中,就包含了上一篇文章中介绍的各种Irvine32属性配置,省却很多麻烦。

A. 设置包含目录(Include Path)
  • 属性 → Microsoft Macro Assembler → General
    • Additional Include Directories : C:\Irvine
B. 设置链接器库目录
  • 属性 → Linker → General
    • Additional Library Directories : C:\Irvine
C. 添加依赖库
  • 属性 → Linker → Input
    • Additional Dependencies :

      复制代码
      Irvine32.lib
      Kernel32.lib
      User32.lib

💡 注意:虽然 Kernel32.lib 和 User32.lib 通常由 Windows SDK 自动链接,但显式添加可避免某些环境下的链接错误。

相关推荐
BD_Marathon20 小时前
安装Jupyter notebook
ide·python·jupyter
宝桥南山2 天前
Visual Studio - 记录一个Visual Studio 2026(Insiders)的更新问题
windows·microsoft·微软·.net·.netcore·visual studio
讓丄帝愛伱2 天前
Zed Markdown 预览不能铺满全屏的原因及解决
ide
BD_Marathon2 天前
Jupyter魔法命令
ide·python·jupyter
郝学胜-神的一滴3 天前
Effective STL 条款 07:指针容器销毁前先删除
开发语言·c++·vscode·leetcode·rpc·visual studio
aaaameliaaa3 天前
VSCode的安装与配置
ide·笔记·vscode·编辑器
宝桥南山6 天前
Visual Studio 2026新特性 - 可以直接连接DeepSeek(使用Custom Endpoint Provider配置项)
ide·microsoft·微软·aigc·.net·visual studio
Risehuxyc6 天前
Visual Studio 2026 安装codebuddy的坑
visual studio
小七在进步6 天前
string的实现(3)
开发语言·c++·笔记·visual studio
H.莓飛7 天前
【C++】【STL】stack_OJ题
服务器·c语言·开发语言·数据结构·c++·算法·visual studio