使用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"
        }
    ]
}

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐