windows下vscode编译sln工程和编译后文件自动拷贝

本文描述了如何使用MSBuild编译Mars.sln工程,并通过powershell在VisualStudio2017中执行Release配置的构建并自动复制生成的文件到指定路径。tasks.json文件详细列出了相关构建任务和依赖关系。

使用MSBuild编译sln工程,使用powershell拷贝文件。

tasks.json如下

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "Run Cmake",
            "command": "./run_cmake.bat -DLOGGER=ON",
            "options": {
                "cwd": "${workspaceFolder}/cmake"
            },
            "problemMatcher": [],
            "presentation": {
                "showReuseMessage": false
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "type": "shell",
            "label": "Build Release",
            "command": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe",
            "args": [
                "Mars.sln",
                "-consoleLoggerParameters:Summary",
                "-verbosity:minimal",
                "-maxCpuCount",
                "-property:Configuration=Release",
                "-property:Platform='x64'"
            ],
            "options": {
                "cwd": "${workspaceFolder}/build"
            },
            "problemMatcher": "$msCompile",
            "presentation": {
                "showReuseMessage": false
            },
            "group": {
                "kind": "build",
                "isDefault": false
            }
        },
        {
            "label": "Build Release and Copy Files",
            "type": "shell",
            "command": "powershell",
            "args": [
                "-Command",
                "Copy-Item -Path ${workspaceFolder}/build/Release/sdk.dll -Destination C:/code/Mars/ ;",
                "Copy-Item -Path ${workspaceFolder}/build/Release/Mars.exe -Destination C:/code/Mars/ ;",
                "Copy-Item -Path ${workspaceFolder}/build/Release/resources -Destination C:/code/Mars/resources -Recurse -Force"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "dependsOn": "Build Release"
        }
    ]
}

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值