首页 \ 问答 \ 以编程方式构建项目 - 如何添加引用路径(Programmatically build project - how to add reference path)

以编程方式构建项目 - 如何添加引用路径(Programmatically build project - how to add reference path)

ProjectCollection pc = new ProjectCollection();

// THERE ARE A LOT OF PROPERTIES HERE, THESE MAP TO THE MSBUILD CLI PROPERTIES
Dictionary<string, string> globalProperty = new Dictionary<string, string>();
globalProperty.Add("Configuration", "Debug");
globalProperty.Add("Platform", "AnyCPU");
globalProperty.Add("OutputPath", @"c:\Output");

FileLogger logger = new FileLogger();
logger.Parameters = string.Format(@"logfile=C:\build.log");
BuildParameters bp = new BuildParameters(pc);
bp.Loggers = new List<ILogger>() { logger };
BuildRequestData buildRequest = new BuildRequestData(buildFileFullName, globalProperty, "4.0", new string[] { "Build" }, null, BuildRequestDataFlags.ReplaceExistingProjectInstance);
// THIS IS WHERE THE MAGIC HAPPENS - IN PROCESS MSBUILD
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(bp, buildRequest);
// A SIMPLE WAY TO CHECK THE RESULT
if(buildResult.OverallResult == BuildResultCode.Success)
{
    Console.WriteLine("ok");
}
else
{
    Console.WriteLine("wrong");
}

嗨,我需要在执行构建之前添加引用路径(就像在视觉中一样)。 我该怎么做


ProjectCollection pc = new ProjectCollection();

// THERE ARE A LOT OF PROPERTIES HERE, THESE MAP TO THE MSBUILD CLI PROPERTIES
Dictionary<string, string> globalProperty = new Dictionary<string, string>();
globalProperty.Add("Configuration", "Debug");
globalProperty.Add("Platform", "AnyCPU");
globalProperty.Add("OutputPath", @"c:\Output");

FileLogger logger = new FileLogger();
logger.Parameters = string.Format(@"logfile=C:\build.log");
BuildParameters bp = new BuildParameters(pc);
bp.Loggers = new List<ILogger>() { logger };
BuildRequestData buildRequest = new BuildRequestData(buildFileFullName, globalProperty, "4.0", new string[] { "Build" }, null, BuildRequestDataFlags.ReplaceExistingProjectInstance);
// THIS IS WHERE THE MAGIC HAPPENS - IN PROCESS MSBUILD
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(bp, buildRequest);
// A SIMPLE WAY TO CHECK THE RESULT
if(buildResult.OverallResult == BuildResultCode.Success)
{
    Console.WriteLine("ok");
}
else
{
    Console.WriteLine("wrong");
}

Hi, I need add reference path before execution building (like in the visual). How should I do this.


原文:https://stackoverflow.com/questions/31537798
更新时间:2023-06-29 13:06

最满意答案

您可以在路由中覆盖serializeQueryParamdeserializeQueryParam私有方法。

https://github.com/emberjs/ember.js/blob/v2.15.1/packages/ember-routing/lib/system/router.js#L703

https://github.com/emberjs/ember.js/blob/v2.15.1/packages/ember-routing/lib/system/router.js#L739

在这些方法中,您可以返回值本身,并从字符串中获取要解析的内容,而不是JSON.stringifyJSON.parse


You can override serializeQueryParam and deserializeQueryParam private methods in your route.

https://github.com/emberjs/ember.js/blob/v2.15.1/packages/ember-routing/lib/system/router.js#L703

https://github.com/emberjs/ember.js/blob/v2.15.1/packages/ember-routing/lib/system/router.js#L739

In these methods instead of JSON.stringify and JSON.parse, you can return the value itself and get whatever you want to parse from the string.

相关问答

更多
  • 我有一个非常类似的问题,并通过重写路由中的serializeQueryParam和deserializeQueryParam使它工作。 在控制器中,您将拥有: queryParams: ['files'], files: [] 在路线中: serializeQueryParam: function(value, urlKey, defaultValueType) { if (defaultValueType === 'array') { return value; / ...
  • 如你所说, http://some.com//en/it/name-50%-other-set-50%-/68是一个糟糕的网址。 你应该有什么好的URL? 为什么//在.com之后? AS you said, http://some.com//en/it/name-50%-other-set-50%-/68 is a bad URL. What is the good URL you're supposed to have ? And why is there // after .com?
  • urllib2.quote("Grønlandsleiret, Oslo, Norway")给出了%27Gr%B8nlandsleiret%2C%20Oslo%2C%20Norway%27 然后明确使用UTF-8: urllib2.quote(u"Grønlandsleiret, Oslo, Norway".encode('UTF-8')) 并始终在您的文件中声明编码。 见PEP 0263 。 非UTF-8字符串需要先解码,然后编码: # You've ...
  • 好的...我找到了答案,对于那些可能遇到同样问题的人。 Ember app kit似乎在一个名为Router的变量中定义Router ,因此我不需要使用传统的命名要求。 所有需要添加到router.js的是: Router.reopen({ location: 'auto' }); :d Ok... I found the answer, for anyone who might run into this same issue. Ember app kit seems to define the r ...
  • 1.9.33的发行说明说: 2016年2月17日 - 版本1.9.33 App Engine备注 现在允许URL路径“/ form”并将其转发给应用程序。 以前,此路径被阻止。 所以看起来警告已经过时了。 The release notes for 1.9.33 say: February 17, 2016 - Version 1.9.33 App Engine notes The URL path "/form" is now allowed and will be forwarded to applic ...
  • 你有没有检查过Ember Model它给你一个基本的适配器,而不必使用EmberData。 Erik在embercasts.com上有一个教程,您可能需要注册成为测试版用户。 var attr = Ember.attr; App.User = Ember.Model.extend({ id: attr(), name: attr() }); App.User.url = "/users"; App.User.adapter = Ember.RESTAdapter.create(); var n ...
  • 您可以在路由中覆盖serializeQueryParam和deserializeQueryParam私有方法。 https://github.com/emberjs/ember.js/blob/v2.15.1/packages/ember-routing/lib/system/router.js#L703 https://github.com/emberjs/ember.js/blob/v2.15.1/packages/ember-routing/lib/system/router.js#L739 在这些方 ...
  • 为了扩展你的评论, basic确实是一个保留字。 具体来说,它是解析器的保留字。 你可以在这里看到来源。 useRouterNaming: function(parsedName) { parsedName.name = parsedName.name.replace(/\./g, '_'); if (parsedName.name === 'basic') { parsedName.name = ''; } }, 而且由于Ember.js有时会在容器中查找路由和控制器的方式,所以 ...
  • 目前它不受支持,但有计划在未来实施支持 - 请参阅github页面上的最新一期。 该线程中的一个回复甚至在此期间实现了自己的支持,所以也许值得研究。 At the moment it is unsupported but there are plans to implement support in the future - see a recent issue on their github page. One of the replies in that thread have even impleme ...
  • 我想回答你的两个问题: 1您可以为所有键定义映射,这里是content属性的示例 App.Adapter.map('App.Post', { myContent: {key: 'content'} }); 2到目前为止我知道在ember中没有这样explicit的保留名称列表,但是根据经验,应该避免像content这样的非常通用的名称(预防性地) 希望能帮助到你 I'm trying to answer your two questions: 1 you can define a mapping fo ...

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)