Configuring Serilog RollingFile with appsettings.json

I'm trying to configure Serilog for a .NET Core project. Here's what I have in my `appsettings.json`: ``` "Serilog": { "MinimumLevel": "Verbose", "Enrich": ["FromLogContext", "WithMachineName...

4 Dec at 23:24

.NET Core Unit Testing - Mock IOptions<T>

I feel like I'm missing something really obvious here. I have classes that require injecting of options using the .NET Core `IOptions` pattern(?). When I unit test that class, I want to mock various v...

ServiceStack DateTime Deserialize Issue

It looks like ServiceStack doesn't like me using a DateTime property as an argument in my request. I'm getting a "Bad Request" message... no other helpful detail in the exception. The inner exception ...

30 Nov at 18:53

How to change object's layer at runtime in Unity?

I've got WallCreator script to place walls in Unity, and another one, WallCreatorSwitcher to turn WallCreator ON/OFF by checking the toggle. I also wanted to change wallPrefab's layer there by using `...

29 Nov at 15:25

Routes in ASP.net Core API

I read lot of topic about routes for API in Asp.net core but I cannot make it work. First, this is my controller : ``` Public class BXLogsController : Controller { //[HttpGet("api/[controller]/I...

Dependency Injection into Entity Framework seed method?

Is it possible to inject dependencies into Configuration class of Entity Framework 6? For example, like this: ``` internal sealed class Configuration : DbMigrationsConfiguration<MyBaseContext> { ...

1 Dec at 21:48

How to get title tag using HTML Agility Pack

I'm parsing an HTML file using HTML Agility Pack. I want to get: Some title As you see, title doesn't have a class. So I couldn't catch it no matter what I have tried. I couldn't find the solution o...

6 May at 18:50

Unit testing fileupload with Moq .net Core

I have a method in WebApi controller that I want to write unit tests for. This is how my controller method looks: ``` public async Task<FileUploadDto> UploadGoalDocument(Guid id) { var ...

29 Nov at 14:24

Open a new window of Google Chrome from C#

It is possible to open a new of Chrome from C#? By I mean a new separate tab, not contained in an existing chrome window. I've tried the following solutions but of them create a in an chrome ...

29 Nov at 07:39

How to get rid of Naming rule violation messages in Visual Studio?

I just installed Visual Studio 2017. When I open an existing website, I get all sorts of warning messages such as this one: > IDE1006 Naming rule violation: These words must begin with upper case c...

10 Apr at 16:22

How to use nameof to get the fully qualified name of a property in a class in C# Attributes?

I am using Foolproof library in ASP.Net MVC project and in some cases I need to check a property within a member class of my model using attribues . For example I have a user class which has a proper...

27 Oct at 19:12

Using connection string from appsettings.json to startup.cs

Currently in Startup, I have my sql server string looking like this: ``` public void ConfigureServices(IServiceCollection services) { var connection = @"Server=servername;Database=database;Truste...

FromBody string parameter is giving null

This is probably something very basic, but I am having trouble figuring out where I am going wrong. I am trying to grab a string from the body of a POST, but "jsonString" only shows as null. I also ...

How can I change a PCL into a .net Platform Standard Library in Visual Studio 2017?

I am trying to figure out how to change a portable .net class library into a .net platform standard library. There is a clickable link in the project settings that looks right it says "Target .net pla...

20 Jun at 09:12

What is deps.json, and how do I make it use relative paths?

I'm setting up an ASP.NET Core project on TeamCity. The binaries it builds crash on startup on other machines. The error message shows that it is looking for dlls in paths that only exist on the build...

5 Dec at 10:28

What is the best way to create a new field for UserAuth?

I would like to create a `DefaultPrinterId` property (field) attached on `UserAuth` table. This `DefaultPrinterId` field is a foreign key on a `Printer.Id` field (`Printer` is a custom table). My que...

28 Nov at 16:56

Failure of delegation of Google Drive access to a service account

I've been involved with building an internal-use application through which users may upload files, to be stored within Google Drive. As it is recommended not to use service accounts as file owners, I ...

2 Dec at 09:44

ServiceStack.Api.Swagger SwaggerResourcesService excluding Routes begining with Route Parameter

I am using Servicestack version 4.0.52.0 and ServiceStack.Api.Swagger 4.0.0.0 I have defined all routes with variable route parameter in serviceStack application host derived class(AppHostBase):Conf...

28 Nov at 16:59

How to read a connectionString WITH PROVIDER in .NET Core?

I added ``` .AddJsonFile("Connections.json", optional: true, reloadOnChange: true) ``` in ``` public Startup(IHostingEnvironment env) ``` Connections.json contains: ``` { "ConnectionStrings...

Servicestack convert IServiceCollection into Funq entries

Does the servicestack.core package contain a [https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection#replacing-the-default-services-container](https://learn.microsoft.com/en-u...

28 Nov at 13:26

"if (object is (string, Color))" c# 7.0 tuple usage doesn't work

I'm using Visual Studio 2017 RC and I have installed the `System.ValueTuple` package which enables the new c# 7.0 tuple usage, but I can't make it work in this specific case: [](https://i.stack.imgur...

27 Nov at 18:37

VSTO Word 2016: Squiggly underline without affecting undo

I am working on a real-time language analysis tool that needs to highlight words to draw attention from the writer in Word 2016 using a VSTO add-in, written in .NET4.6.1 with C#. Think of the grammar/...

27 Nov at 13:14

ASP.NET Core Model Binding Error Messages Localization

I'm using ASP.NET Core, and trying to localize the application. I managed to use asp .net core resources to localize controllers and views, and resources to localize error messages for model validat...

ViewModel concept still exists in ASP.NET MVC Core?

In previous versions of ASP.NET MVC you find some informations about ViewModels and how to use them in this version. I'm wondering why I can't find any information about this topic in ASP.NET Core M...

9 Apr at 17:39

Unable to return Tuple from a method using Visual Studio 2017 and C# 7.0

I've installed Visual Studio 2017 Community that was released a week ago, and I started exploring the new features of C# 7. So I created a simple method that returns two values: ``` public class Pro...