dnx

Asp.Net 5 (core) RC1: How to log to file (rolling file logging) [DNX Core 5 compatible solution]?

雨燕双飞 提交于 2019-12-01 17:04:16
How can I log to file in Asp.Net 5 RC1? I couldn't find any solution with Microsoft.Extensions.Logging. Is there any solution which is compatible with .Net Core 5 (DNX Core 5.0)? I also was trying to use Serilog but Serilog doesn't support core 5 yet. To use Serilog in your ASP.NET 5 RC1 project, add the following dependencies in your project.json file: "Serilog.Extensions.Logging": "1.0.0-rc1-final-10092", "Serilog.Sinks.RollingFile": "2.0.0-beta-465" Create the logger in the Startup constructor: public Startup(IApplicationEnvironment appEnv) { Log.Logger = new LoggerConfiguration()

Database-first EF7-beta7 dnx ef dbcontext scaffold command fails

房东的猫 提交于 2019-12-01 16:42:15
In an asp.net 5 beta 7 project no matter how the command is written I get an unrecognized argument trying to scaffold the dbcontext from an existing db: C:\Dev\Project>dnx ef dbcontext scaffold provider EntityFramework.SqlServer connection "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=ubercrew_relation;Integrated Security=True" I've tried all possible combinations of the two arguments connection and provider Do you know the right syntax for executing the scaffold command? alfberga The right command is: C:\Dev\Project>dnx ef dbcontext scaffold "Data Source=(localdb)\MSSQLLocalDB;Initial

Asp.Net 5 (core) RC1: How to log to file (rolling file logging) [DNX Core 5 compatible solution]?

十年热恋 提交于 2019-12-01 16:15:31
问题 How can I log to file in Asp.Net 5 RC1? I couldn't find any solution with Microsoft.Extensions.Logging. Is there any solution which is compatible with .Net Core 5 (DNX Core 5.0)? I also was trying to use Serilog but Serilog doesn't support core 5 yet. 回答1: To use Serilog in your ASP.NET 5 RC1 project, add the following dependencies in your project.json file: "Serilog.Extensions.Logging": "1.0.0-rc1-final-10092", "Serilog.Sinks.RollingFile": "2.0.0-beta-465" Create the logger in the Startup

Visual Studio 2015 Test Explorer does not see XUnit dnx traits

人盡茶涼 提交于 2019-12-01 16:09:23
The Visual Studio 2015 Test Explorer does not recognize my test traits. When I add this to a test in a DNX project: [Trait("Category", "Test")] the test still shows up in the Test Explorer under the No Traits group (when grouping tests by Traits). Looks like this is already logged as an issue: VS 2015 Bugs - Traits and Project Grouping in Test Explorer #485 来源: https://stackoverflow.com/questions/32258618/visual-studio-2015-test-explorer-does-not-see-xunit-dnx-traits

Where did Attribute.IsDefined go in DNX Core 5.0?

非 Y 不嫁゛ 提交于 2019-12-01 16:04:28
I'm trying to check if a property has an attribute. This used to be done with: Attribute.IsDefined(propertyInfo, typeof(AttributeClass)); However I get a warning that it's not available in DNX Core 5.0 (it still is in DNX 4.5.1). Has it not been implemented yet or has it moved like other type/reflection related stuff? I'm using beta7. Henk Mollema Edit: There actually seems to be an IsDefined extension method in the System.Reflection.Extensions package. Usage: var defined = propertyInfo.IsDefined(typeof(AttributeClass)); You need to include the System.Reflection namespace. The reference source

EF 6 with a dnx project

这一生的挚爱 提交于 2019-12-01 15:57:18
I have a new ASP.net 5 dnx class library I am using for entity framework. I need to target EF 6 because some features I need are not in EF 7. First the EF tools (like enable-migration) were not there. I added an old style class library and installed EF 6 and now the commands are there. When I run enable migrations I get this error: PM> Enable-Migrations Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=14.1.0.0, Culture=neutral

publish dnx based WebJob with local dependencies

天大地大妈咪最大 提交于 2019-12-01 11:24:40
问题 I'm trying to publish my DNX-based WebJob to Azure. To do this I add my project.json and Program.cs files to some ZIP-archive and upload it through Azure portal. This works fine, but now i want my WebJob project to reference some other local DNX-based project (just a simple class library). How do I upload it in this case? 回答1: Here is a sample repo that works https://github.com/ahmelsayed-test/DnxWebJobWithClassLibrary. Clone it, zip it, and upload it. It should work! Unfortunately the

Using xUnit test with UWP app on VS2015

人盡茶涼 提交于 2019-12-01 10:41:51
问题 This is a follow-up to this question. I followed the steps as described here and the sample tests work as expected. This is the first time I got to this working sample, but wait for the real working setup which is where I am having trouble. As a next step to testing my app, I added my UWP app project using "Add Reference..." to the xUnit Test project. Now, after I referencing my project, when I run the test (Run All in Test Explorer pane VS2015) I get the following error: Error Payload

Write to EventLog in .Net Core

徘徊边缘 提交于 2019-12-01 03:44:04
I need a way to write to Windows' event viewer in my app that's using dnx. But, the EventLog class isn't available in the System.Diagnostics namespace so I'm stuck. Is there any other way to write to the EventViewer? praveen Add from NuGet Microsoft.Extensions.Logging.EventLog Version 2.1.1 CM> Install-Package Microsoft.Extensions.Logging.EventLog -Version 2.1.1 Include the namespace Microsoft.Extensions.Logging.EventLog in the Program.cs file This resolved my problem. Good news! EventLog is already ported to corefx and will be available in .NET Core 2.1 . Right now you can download a preview

How to create and use ASP.NET vNext class library NuGet package?

守給你的承諾、 提交于 2019-12-01 03:41:24
I would like to create a NuGet package of my ASP.NET vNext class library. How can I do it, step by step? I understand there is kpm build , but I couldn't find a guide regarding where to download kpm, etc. Also, after getting a NuGet package (or DLL) of it, how can I add it from local machine to my vNext project? Kpm is the package manager for the new KRuntime. Instructions on how to install the KRuntime command line utilities on your developer machine can be found on the aspnet Home repo . Once you have kvm and a version of the KRuntime set up you will have kpm available as well. Now you can