TLDR:在为dotnet pack
程序集创建nuget包时,在哪里提取版本信息?
我有一个库,我已经从.NET 4.6.1项目转换为.NET Core项目project.json
.对于我在此期间的CI(使用TFS 2015 vnext),我会得到我的版本号,并用新版本替换project.json文件中的版本号.该dotnet pack
命令可以很好地选择版本,并创建一个包含更新版本号的新包.
上周,我从2015年TFS升级到2017年TFS.原来,project.json被更新的.csproj文件取代.我已经更新了我的CI.在我的CI期间 - 我更新了我的/Properties/AssemblyInfo.cs
文件,将AssemblyVersion
标签替换为当前版本的版本.然后我构建了解决方案 - 构建得很好.然后我打包解决方案.
不过,尽管AssemblyVersion
和AssemblyFileVersion
在被设置AssemblyInfo.cs
为正确的版本号- dotnet pack
仍在生产.nupkg那些文件*.1.0.0.nupkg
.
我错过了什么?
这是我的包命令:
dotnet pack $projectFile -o $currentDirectory
Run Code Online (Sandbox Code Playgroud) 我想知道究竟是什么Where()
和ToList()
方法在做什么.具体来说,我想知道是否Where()
会在内存中创建一个新对象或返回一个新对象.
好的,看下面的代码,说我有一个骨架日志类.
public class Log()
{
public string Log {get;set;}
public string CreatedByUserId {get;set;}
public string ModifiedUserId {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
在我的业务逻辑中,假设我只想要由某个用户创建或修改的日志.这将通过一种方法完成:FilterLogsAccordingToUserId()
.
public IEnumerable<Log> FilterLogsAccordingToUserId(IEnumerable<Log> logs, string userId)
{
int user = int.Parse(userId);
return logs.Where(x => x.CreatedByUserId.Equals(user) ||
x.ModifiedByUserId.Equals(user)).ToList();
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,是通过删除与条件不匹配的所有对象Where()
来修改IEnumerable<Log>
,还是抓取所有对象,将该对象强制转换为内存中的列表,然后返回该新对象?
如果这是第二种可能性,如果将足够大的日志列表传递给函数,我是否应该关注性能?
我想将Sitecore 7中的搜索索引限制为仅扫描内容树的一个节点.
目前结构如下:
该索引正在索引两个BaseNode
&$Company Node
,但我只希望它索引$Company Node
.
我已经更新了默认/sitecore/content
的路径Sitecore.ContentSearch.config
,SitecoreContentSearch.Lucene.DefaultIndexConfiguration.config
,Sitecore.ContentSearch.Lucene.Index.Master
,和Sitecore.ContentSearch.LuceneIndex.Web.config
.当我更新<root>
要指向的元素/sitecore/content/$CompanyNode
时,当我尝试重建索引时,我得到以下异常.
任何想法我需要做什么来限制Lucene只是索引一些项目,而不是一切?
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at …
Run Code Online (Sandbox Code Playgroud) 这似乎是一项非常简单的任务,但我似乎无法弄明白.如何为Sitecore中的特定字段分配验证?
我可以看到列出的验证规则/sitecore/system/Settings/Validation Rules/Field Rules/
.
如何从此处将规则分配给模板上的字段?
我已经看过几篇关于创建自定义OnSave操作的博客文章,该操作评估项目及其字段 - 然后您将在Web配置中进行连接 - 但这对我正在尝试完成的事情来说太过分了.Sitecore本身的博客文章或pdf都没有显示如何设置真正简单的验证(或者我找不到它们).
我正在尝试插入我在Webforms for Marketers 2.3中创建的新表单.我转到我要插入表单的页面,演示文稿选项卡,表单,插入.我选择我创建的表单,然后得到一条消息 - "没有允许的占位符来插入新表单".
然后我去了Layout-Placeholder Settings-Content并为Marketeres - Form添加了Layout-Renderings-Modules-Webforms.
没有成功.
我也尝试过添加表单,而不是Webforms for Marketers限制占位符设置.
没有成功.
那么,有谁知道我错过了什么?我是否需要在子布局中添加特定的sitecore占位符来保存表单?
我不熟悉以下语法,我想知道变量退出大括号后会发生什么变化:
public string method(int projectid)
{
string result = string.empty;
var service = _service;
{
result = service.dosomething(); //_service implements it's own Dispose
}
result += "we are going to do some further operations like sum a large list that"
result += "might take a non-trivial amount of time."
return result;
}
Run Code Online (Sandbox Code Playgroud)
紧随其后的括号是否_service: { /* etc */ }
表示服务变量仅在该.dosomething()
方法的范围内,之后在执行由result +=
块指示的X操作时- 垃圾收集器可以对服务进行舍入并且垃圾收集它?
基本上,我想知道周围的括号var result = service.dosomething()
是什么告诉编译器关于service
和_service
.
我在这里有一个非常基本的站点核心问题.我想迭代一组子对象(位置),并显示有关每个对象的一些信息.
我正在使用ASP转发器进行迭代,我正在让页面加载孩子,我正在尝试使用sc标签来显示信息 - 但我不会在页面上显示.
任何人都可以帮我看看我在这里失踪了吗?
代码背后:
protected void Page_Load(object sender, EventArgs e)
{
var item = Sitecore.Context.Item;
var children = new List<Sitecore.Data.Items.Item>();
foreach (var child in item.GetChildren())
{
children.Add((Sitecore.Data.Items.Item)child);
}
LocationsRpt.DataSource = children;
LocationsRpt.DataBind();
}
Run Code Online (Sandbox Code Playgroud)
标记:
<asp:Repeater runat="server" ID="LocationsRpt" OnItemDataBound="LocationsRptItemDataBound">
<ItemTemplate>
<div class="InnerContentSec clearfix">
<div id="AboutSolar" class="AboutSolar clearfix">
<div class="items">
<h3>
<sc:Text runat="server" ID="Title"/>
</h3>
<div class="LocationBlock clearfix">
<div class="ImgSec">
<sc:Image id="Image" runat="server" Width="185" Height="107" />
</div>
<div class="DescSec">
<p><sc:Text ID="ShortDescription" runat="server" /></p>
</div>
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater> …
Run Code Online (Sandbox Code Playgroud)