RequireJS script error when requiring “ReleaseaManagement/Core/RestClient” on TFS 2015 and 2017

筅森魡賤 提交于 2020-01-05 05:31:46

问题


I'm creating an tfs hub Extension (2015/2017) and need to read the projects' release defs and create releases also. I know, I could make direkt Rest Calls instead of using the methods of the rest clients. But they seem more comfortable to me.

When I try to get the Restmanagement RestClient, I get: Script error for: ReleaseManagement/Core/RestClient http://requirejs.org/docs/errors.html#scripterror

In both TFS.2015.2 and TFS.2017

Doesn't the client yet exist on-premise?


回答1:


You can refer to this article for how to use Rest API in extension to read a release definition: Writing a ReleaseManagement extension for cloning an existing release definition.

The code to read a release definition:

VSS.require(["VSS/Controls", "VSS/Service", "ReleaseManagement/Core/RestClient"],
var rmClient = VSS_Service.getCollectionClient(RM_WebApi.ReleaseHttpClient);
rmClient.getReleaseDefinition(vsoContext.project.id,sourceItemContext.definition.id);

And if you are using typescript, you need to include "ms.vss-releaseManagement-web.release-service-data-external" in the contribution like following:

"contributions": [
        {
            "id": "release-status",
            "type": "ms.vss-web.hub",
            "includes": [ "ms.vss-releaseManagement-web.release-service-data-external" ],
            "description": "A hub to show release status",
            "targets": [
                "ms.vss-work-web.work-hub-group"
            ],
            "properties": {
                "name": "hello",
                "order": 99,
                "uri": "app.html"
            }
        }
    ]


来源:https://stackoverflow.com/questions/43779669/requirejs-script-error-when-requiring-releaseamanagement-core-restclient-on-tf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!