小编Nec*_*ras的帖子

如何使用ProjectTypeGuids打开csproj 349c5851-65df-11da-9384-00065b846f21?

我有Visual Studio 2012专业版.当我尝试打开特定的csproj时,我收到一条错误消息

此安装不支持项目类型.

它没有说明项目的"项目类型",也没有说明我需要安装什么才能打开它.

在检查.csproj文件时,我看到了这些行

<ProductVersion>9.0.30729</ProductVersion>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
Run Code Online (Sandbox Code Playgroud)

那么我需要安装什么才能打开这个项目?请提供链接!

visual-studio

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

在Powershell中,如何将对象数组的一个属性连接成一个字符串?

例如,我在c:\ z中有3个文件

PS C:\z> dir | select name

Name
----
a.png
b.png
c.png
Run Code Online (Sandbox Code Playgroud)

我想要的是一个字符串.

a.png,b.png,c.png

谢谢.

arrays string powershell join

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

如何在.net核心中测试Dapper查询?

使用针对完整.net Framework的代码,我可以模拟IDbConnection并将其指向模拟的DataSet,以便测试我的查询是否正确执行.同样,如果我使用EntityFramework 6,我可以让一个模拟的DbSet返回IQueryables并测试我的数据层逻辑.

但.net核心不支持DataSet(虽然将来可能会改变?).

与此同时,有没有办法创建一个对象集合,dapper可以使用IDbConnection进行查询以测试查询逻辑?

unit-testing dapper .net-core

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

"dapper-dot-net"中的交易

如果我的DAL使用dapper-dot-net,如何创建交易?

我的c#winform应用程序将在网络中使用,数据将保存到中央sql server.

我的用例需要使用事务.我可以使用dapper来做这个,还是需要使用像NHibernate这样的东西?

此外,如果我使用存储过程,是否存在此框架的任何风险或限制?由于任何可能的限制,我是否需要改变我的方法?

architecture data-access-layer dapper

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

如何将依赖项注入 .Net Core 项目中的自定义 WebHostService?

我试图创建所描述的,这将作为Windows服务运行的服务在这里。我的问题是示例 Web 主机服务构造函数只接受一个IWebHost参数。我的服务需要一个更像这样的构造函数:

public static class HostExtensions
{
    public static void RunAsMyService(this IWebHost host)
    {
        var webHostService =
            new MyService(host, loggerFactory, myClientFactory, schedulerProvider);
        ServiceBase.Run(webHostService);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的Startup.cs文件看起来类似于:

public Startup(IHostingEnvironment env)
{
    var builder = new ConfigurationBuilder()
        .AddJsonFile("appsettings.json")
        .AddEnvironmentVariables()
        .AddInMemoryCollection();

    this.Configuration = builder.Build();
}

public void ConfigureServices(IServiceCollection services)
{
    services.AddOptions();
    this.container.RegisterSingleton<IConfiguration>(this.Configuration);
    services.AddSingleton<IControllerActivator>(
        new SimpleInjectorControllerActivator(container));
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, 
    ILoggerFactory loggerFactory)
{
    app.UseSimpleInjectorAspNetRequestScoping(this.container);

    this.container.Options.DefaultScopedLifestyle = new AspNetRequestLifestyle();

    this.InitializeContainer(app, loggerFactory);
    this.container.Verify();

    if (env.IsDevelopment())
    { …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection simple-injector asp.net-core

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

如何在 .net Core 应用程序中使用 IConfiguration 绑定多级配置对象?

我正在尝试绑定到应该由 appsettings.json 文件填充的自定义配置对象。

我的 appsettings 看起来有点像:

{
  "Logging": {
    "IncludeScopes": true,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  },
  "Settings": {
    "Foo": {
      "Interval": 30,
      "Count": 10
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

设置类如下所示:

public class Settings
{
  public Foo myFoo {get;set;}
}

public class Foo
{
  public int Interval {get;set;}
  public int Count {get;set;}

  public Foo()
  {}

  // This is used for unit testing. Should be irrelevant to this question, but included here for completeness' sake.
  public Foo(int interval, int …
Run Code Online (Sandbox Code Playgroud)

c# json .net-core asp.net-core

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

Docker 停留在 npm install

我有一个要 dockerize 的项目。我运行npm install,并npm build与我的计算机上没有任何问题,但它有一些问题,当我建立与码头工人。

码头工人输出:

Sending build context to Docker daemon  56.96MB
Step 1/7 : FROM node:12.2.0-alpine
---> f391dabf9dce
Step 2/7 : WORKDIR /app
---> Using cache
---> b50a8efbf074
Step 3/7 : ENV PATH /app/node_modules/.bin:$PATH
---> Using cache
---> 3358967a13ab
Step 4/7 : COPY package.json /app/package.json
---> Using cache
---> 851ac31a0adb
Step 5/7 : RUN npm install
---> Running in 8cc36a435cec
npm WARN deprecated core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or …
Run Code Online (Sandbox Code Playgroud)

docker reactjs dockerfile

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

使用 filebeat 和 logstash 标记索引

我使用 logstash-forwarder 和 logstash 并使用以下配置创建带有标签的动态索引:

/etc/logstash/conf.d/10-output.conf

output {
  elasticsearch {
    hosts => "localhost:9200"
    manage_template => false
    index => "logstash-%{tags}-%{+YYYY.MM.dd}"
  }
}
Run Code Online (Sandbox Code Playgroud)

/etc/logstash-forwarder.conf

"files": [
    {
      "paths": [
        "/var/log/httpd/ssl_access_log",
        "/var/log/httpd/ssl_error_log"
       ],
      "fields": { "type": "apache", "tags": "mytag" }
    },
Run Code Online (Sandbox Code Playgroud)

相关的 filebeat 配置是:

/etc/filebeat/filebeat.yml

filebeat:
  prospectors:
    -
     paths:
       - /var/log/httpd/access_log
     input_type: log
     document_type: apache
     fields:
       tags: mytag
Run Code Online (Sandbox Code Playgroud)

在 Kibana 中,mytag我看到的不是我beats_input_codec_plain_applied所有的索引。

logstash logstash-forwarder filebeat

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

terraform init 注册表服务无法访问

我正在尝试使用办公室网络中的 terraform 构建虚拟机。我收到以下错误,因为服务器无法访问互联网。无论如何,我可以离线下载插件吗?

Initializing provider plugins...
- Checking for available provider plugins...

Registry service unreachable.

This may indicate a network issue, or an issue with the requested Terraform Registry.


Error: registry service is unreachable, check https://status.hashicorp.com/ for status updates
Run Code Online (Sandbox Code Playgroud)

terraform

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

Moq 枚举在 FirstOrDefault 上消失

我编写了一个测试来验证一小部分新功能,该功能调用一个大型中间件函数,其中包含大量逻辑,将一种类型的用户(ASP Net Membership User)转换为内部类型(SystemUser)。这是一个混乱的系统,但我无法将其撕掉,因此需要进行新的测试。

我的测试调用了一个GetAllActiveUsers()方法,该方法向下调用几层并最终到达导致问题的枚举。该测试有一个模拟的实体框架数据上下文Mock<localEntities> mockDb,其设置如下:

[SetUp]
public void Setup()
    {
        var mockUserSet = new Mock<DbSet<User>>();

        this.mockDb = new Mock<localEntities>();
        this.mockMembershipService = new Mock<IMembershipService>();
        this.mockRoleService = new Mock<IRoleService>();
        this.mockUserAgreementRelation = new Mock<DbSet<UserAgreementRelation>>();

        this.testUsers = this.CreateSystemUsers();

        this.mockDb.Setup(m => m.User).Returns(mockUserSet.Object);

        mockUserAgreementRelation.SetupAllProperties();

        var agreementRelations = this.testUsers.Select(u => new UserAgreementRelation() { AgentUserID = u.UserId, IsDeleted = null });

        mockUserAgreementRelation.As<IQueryable<UserAgreementRelation>>().Setup(ua => ua.GetEnumerator()).Returns(agreementRelations.GetEnumerator());
        this.mockDb.Setup(m => m.UserAgreementRelation).Returns(mockUserAgreementRelation.Object);
    }
Run Code Online (Sandbox Code Playgroud)

在我的测试中,我设置了一些用户并调用var testActiveUsers = testRepo.GetAllActiveUsers();问题线路。

这就是我感到困惑的地方。

使用以下代码测试通过:

var agreementRelations = databaseContext.UserAgreementRelation().ToList();

var userAgreementFromDB = …
Run Code Online (Sandbox Code Playgroud)

c# unit-testing asp.net-membership moq

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