小编ale*_*rya的帖子

11
推荐指数
1
解决办法
9686
查看次数

vs 2012:Shims编译

我试图在VS 2012终极中制作一个垫片,如MSDN网站中所述:

[TestClass]
public class TestClass1
{ 
    [TestMethod]
    public void TestCurrentYear()
    {
        int fixedYear = 2000;

        using (ShimsContext.Create())
        {
          // Arrange:
          // Detour DateTime.Now to return a fixed date:
          System.Fakes.ShimDateTime.NowGet = 
              () =>
              { return new DateTime(fixedYear, 1, 1); };

          // Instantiate the component under test:
          var componentUnderTest = new MyComponent();

          // Act:
          int year = componentUnderTest.GetTheCurrentYear();

          // Assert: 
          // This will always be true if the component is working:
          Assert.AreEqual(fixedYear, year);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

请参阅http://msdn.microsoft.com/en-us/library/hh549176.aspx

但是当我编译我的测试项目时,我在输出中得到了一个概念:

警告:无法生成一些假货.有关完整的详细信息,请将此文件中Fakes元素的Diagnostic属性设置为"true"并重建项目.

我该如何解决此警告?

shim microsoft-fakes visual-studio-2012

10
推荐指数
1
解决办法
1万
查看次数

意外的打字稿这是未定义的类型

    /// <reference path="../typings/signalr/signalr.d.ts" />
/// <reference path="../typings/jquery/jquery.d.ts" />

interface IMyBlackjack {

}

module My {
    export class MyBlackjack implements IMyBlackjack {

        private hub: HubProxy;
        private cnn: HubConnection;

        constructor() {
            $("#formBlackJack").hide();

            this.cnn = $.hubConnection();
            this.hub = this.cnn.createHubProxy("blackjackHub");
            this.cnn.start(() => this.onConnStart);
        }

        private onConnStart(): void {
            $("#formBlackJack").show();
            this.hub.invoke('hello');
        }
    }
}

var myBlackjack: IMyBlackjack = new My.MyBlackjack();
Run Code Online (Sandbox Code Playgroud)

代码中存在问题:

this.hub.invoke('hello');
Run Code Online (Sandbox Code Playgroud)

this.hub令人惊讶地未定义.

我希望它应该成为一个对象.有什么想法吗?

typescript

8
推荐指数
1
解决办法
3022
查看次数

Visual Studio 扩展获取所有类和接口元数据

我已经成功创建了 Visual Studio 扩展项目。它工作得很好而且很整洁。我为解决方案做了一些事件。

MSDN 和 Internet 中的手册很简短。我找不到我的问题的答案:如何在安装此扩展包的解决方案中检索与类和接口(命名空间、类名、基类型等)相关的所有元数据?

c# visual-studio

5
推荐指数
1
解决办法
3011
查看次数

使用键盘快捷键时出现"VSDebug Message"对话框

当我使用ctrl + shift + B快捷键在VS2015 Update 2中制作Build Solution命令时出现错误:

---------------------------
VSDebug Message
---------------------------
Command data:



    Guid = {5EFC7975-14BC-11CF-9B2B-00AA00573819}

    GuidID = 11

    CmdID = 882

    Type = 0x00000001

    Flags = 0x00000048

    Canonical name = Build.BuildSolution

    Localized name = (Not set)
---------------------------
OK   
---------------------------
Run Code Online (Sandbox Code Playgroud)

如果我使用鼠标,它的效果很好.清理缓存甚至重新安装没有帮助.怎么解决?

visual-studio

5
推荐指数
1
解决办法
302
查看次数

角度材质保存并将 pageSize 恢复到 localStorage 中

我想将 pageSize 保存并恢复到 localStorage 中。首先,我在脑海中创建了一个指令。它部分有效:)我可以保存 pageSize。但如何阅读呢?

请各位大神指点一下!

import { Directive, ElementRef, OnDestroy, HostListener, HostBinding } from 

'@angular/core';
import { UserClientOptionsService } from 'app/user-client-options.service';

@Directive({
  selector: '[itemsPerPage]'
})
export class ItemsPerPageDirective implements OnDestroy {

  constructor(private element: ElementRef, private optionsService: UserClientOptionsService) {
  }

  // it doesn't work. No property pageSize exists
  //@HostBinding('pageSize')
  //pageSize: number;

  @HostListener('page', ['$event'])
  onChange(e) {
    this.optionsService.update(x => x.itemsPerPage = e.pageSize);
  }

  ngOnDestroy() {
  }
}
Run Code Online (Sandbox Code Playgroud)

和 HTML:

<mat-paginator [length]="src" pageSize="10" itemsPerPage [pageSizeOptions]="[5, 10, 20]"></mat-paginator>
Run Code Online (Sandbox Code Playgroud)

angular-material angular

4
推荐指数
1
解决办法
1803
查看次数

C#Indexer和Linq

我在课堂上有一个属性:

public int this[int index]
        {
            get { return _desk[index]; }
            set { _desk[index] = value; }
        }
Run Code Online (Sandbox Code Playgroud)

但我不能在Linq使用这个课程.怎么做?

c# linq indexer

2
推荐指数
1
解决办法
1365
查看次数

VS 2012和Windows 2008 Server Enterprise

当我尝试在Windows Server 2008 Enterprise上安装Visual Studio 2012时,我收到安装程序的错误消息.

  You must upgrade or update Operating Systems to the latest Service Pack using Window Update to meet the requirement before installing this products.
  For Windows 8, this product is not compatible with pre-released versions of Windows 8. Please upgrade to latest release version of Windows 8.
  This computer does not meet the setup requirements. For more information, see the readme.
  http://go.microsoft.com/fwlink/?LinkId=255962
Run Code Online (Sandbox Code Playgroud)

我已在操作系统上安装了每个更新.我该怎么做才能安装VS2012 Ultimate?

windows-server-2008 visual-studio

1
推荐指数
1
解决办法
1万
查看次数

Visual Studio解决方案中的项目名称有时为空

在Visual Studio扩展中,我想获取所有项目及其名称:

var service = (DTE) Package.GetGlobalService(typeof (SDTE));
var projects = service.Solution.Projects;

foreach (Project project in projects)
//....
Run Code Online (Sandbox Code Playgroud)

除了一个小问题外,这种方法很好用,很整洁:项目变量实际上返回了确切的项目数。但是,如果项目的全名位于解决方案的文件夹中,则可能为EMPTY。(我的意思是当项目合并在解决方案的文件夹中时解决方案的结构)

如何正确地获得这些项目?

c# visual-studio visual-studio-extensions

1
推荐指数
1
解决办法
1539
查看次数