我最近开始使用NuGet来管理外部包.现在我只需要它用于NLog.当我在VS 2012中构建项目时,一切正常.但是,我正在尝试将TeamCity作为CI服务器(我对CI很新)并且它给了我以下错误:
[Csc] SomeNamespace\SomeClass.cs(10, 7): error CS0246: 
The type or namespace name 'NLog' could not be found 
(are you missing a using directive or an assembly reference?)
Run Code Online (Sandbox Code Playgroud)
(在我使用NLog的地方重复此错误)
现在我没有在SVN中包含'packages /'文件夹,因为我认为最好不要包含二进制文件,让TeamCity中的MSBuild自行下载.然而,显然没有这样做.我在SVN中包含'packages.xml'文件.我可以检查什么是出错的?
更新 感谢@DavidBrabant,我被推向了正确的方向.但是,我现在在TeamCity中收到以下错误:
Package restore is disabled by default. To give consent, open the Visual Studio Options dialog, 
click on Package Manager node and check 'Allow NuGet to download missing packages during build.'
Run Code Online (Sandbox Code Playgroud)
但是我不是Visual Studio而是TeamCity,所以我不知道如何设置'同意'为真!我试图在NuGet.targets文件中将RestorePackages设置为'true':
<RestorePackages Condition="  '$(RestorePackages)' == '' ">true</RestorePackages>
Run Code Online (Sandbox Code Playgroud)
但这没用.
更新2 为了使其工作,我还设置了以下属性NuGet.targets:
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'true' ">false</RequireRestoreConsent>
Run Code Online (Sandbox Code Playgroud)
这使得构建成功运行!
我想返回按某个属性分组的某个实体的列表,按时间戳降序排序并分页(使用Skip和Take).我得到的是这个:
container.CoinMessageSet.Where(
                c => c.MessageState != MessageStateType.Closed &&
                     (c.DonorOperator.OperatorCode.Equals("opcode") ||
                      c.RecipientOperator.OperatorCode.Equals("opcode"))
                ).OrderByDescending(c => c.TimeStamp)
                 .GroupBy(c => c.Reference).Skip(x).Take(100);
Run Code Online (Sandbox Code Playgroud)
执行后我得到了例外:
The method 'Skip' is only supported for sorted input in LINQ to Entities. 
The method 'OrderBy' must be called before the method 'Skip'.
Run Code Online (Sandbox Code Playgroud)
...我调用了OrderBy()(尽管是Descending),我在Skip()之前调用了它!我错过了什么?
所以我在PHP中有这个项目,我在wwwroot(或doc-root)文件夹旁边有一些包含文件,而不是在wwwroot文件夹下.但是我需要运行/调试这个项目.在项目属性中我可以选择一个索引文件(index.php),但它位于doc-root文件夹下,因此项目URL生成http://myprojectmachine/doc-root/index.php而不是..:// myprojectmachine的index.php.手动键入索引文件不起作用,因为NetBeans声明找不到该文件.我怎样才能以优雅的方式克服这个问题?
我有一个想要显示在DataGrid中的Customer对象的列表。我通过后面的代码绑定了列表:
dataGrid.DataContext = customers;
Run Code Online (Sandbox Code Playgroud)
每个客户都有一个或多个电话号码。我想在客户的行/记录中列出它们。我该怎么做呢?我的DataGrid在XAML中如下所示:
<DataGrid AutoGenerateColumns="False" Height="212" IsReadOnly="True"
    HorizontalAlignment="Left" Margin="12,41,0,0" ItemsSource="{Binding}"   
    Name="dataGrid" VerticalAlignment="Top" Width="932">
  <DataGrid.Columns>
    <DataGridTextColumn Binding="{Binding Path=LastName}" Header="Porting ID"/>
    <DataGridTextColumn Binding="{Binding Path=FirstName}" Header="Operator" />
  </DataGrid.Columns>
</DataGrid>
Run Code Online (Sandbox Code Playgroud)
客户类是:
public class Customer
{
  public String LastName { get; set; }
  public String FirstName { get; set; }
  public List<Phonenumber> PhoneNumbers { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
PhoneNumber类为:
public class PhoneNumber
{
  public String AreaCode {get;set;}
  public String Number {get;set;}
}
Run Code Online (Sandbox Code Playgroud)