以编程方式添加资产

时间:2016-03-04 19:03:57

标签: c# visual-studio msbuild visual-studio-2015 win-universal-app

作为CI构建的一部分,我需要将一千兆字节的图像内容添加到我的项目文件中,以便将其编译到我的appx中。所包含文件的数据和列表经常更改,因此无法事先将其包含在项目中。再加上庞大的规模会让我们的回购变得巨大。

除了破解csproj本身并添加一堆xml来执行此操作之外,有没有办法在构建时执行此操作?也许在预构建中运行命令的东西?

1 个答案:

答案 0 :(得分:0)

所以,我花了很多时间在这上面,事实证明只是使用预构建步骤将无法工作,因为你实际上必须修改csproj文件。编译后,简单地使用MakeAppx将无法正常工作,编译过程实际上会对您的appxmanifest进行更改。

我最终编写了一个小型控制台应用程序,在调用MSBuild之前在脚本中完成工作。我把它包括在下面。

var app = angular.module('mainApp', []);

app.controller('people', function($scope) {
    $scope.persons = rolodex.entries;
});

var rolodex = {
    "entries": [
    {
        "firstName": "Don",
        "lastName": "Malbatop",
        "Age": "36",
        "Company": "Amazon",
        "Address": "405 White St",
        "City": "Washington",
        "State": "DC",
        "Zip": "20015"
    },
    {
        "firstName": "Donna",
        "lastName": "Montell",
        "Age": "56",
        "Company": "National Institute of Health (NIH)",
        "Address": "456 L St",
        "City": "Washington",
        "State": "DC",
        "Zip": "20016"
    },
        {
        "firstName": "Rachael",
        "lastName": "Maple",
        "Age": "31",
        "Company": "National Remy Association (NRA)",
        "Address": "4056 K St",
        "City": "Washington",
        "State": "DC",
        "Zip": "20017"
    },
        {
        "firstName": "Tammy",
        "lastName": "Trump",
        "Age": "47",
        "Company": "Logo Inc.",
        "Address": "405 Red St",
        "City": "Washington",
        "State": "DC",
        "Zip": "20015"
    },
        {
        "firstName": "Jon",
        "lastName": "Macon",
        "Age": "37",
        "Company": "Bill Supply",
        "Address": "405 Conneticut Ave",
        "City": "Washington",
        "State": "DC",
        "Zip": "20015"
    },
        {
        "firstName": "Pam",
        "lastName": "Oliver",
        "Age": "32",
        "Company": "Postmates",
        "Address": "405 Yellow St",
        "City": "Washington",
        "State": "DC",
        "Zip": "20015"
    }]}