Skip to content

Commit

Permalink
remove refs to project.json (dotnet#2563)
Browse files Browse the repository at this point in the history
* remove refs to project.json

* use code formatting
  • Loading branch information
tdykstra authored and Rick-Anderson committed Jan 20, 2017
1 parent 50d1def commit 2118ca4
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 32 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ To render a portion of a file as a snippet by using line numbers:
```
[!code-csharp[Main](configuration/sample/Program.cs?range=1-10,20,30,40-50]
[!code-html[Main](configuration/sample/Views/Home/Index.cshtml?range=1-10,20,30,40-50]
[!code-javascript[Main](configuration/sample/Project.json?range=1-10,20,30,40-50]
```

For C# snippets, you can reference a [C# region](https://msdn.microsoft.com/en-us/library/9a1ybwek.aspx). Whenever possible, use regions rather than line numbers, because line numbers in a code file tend to change and get out of sync with line number references in Markdown. C# regions can be nested, and if you reference the outer region, the inner `#region` and `#endregion` directives are not rendered in a snippet.
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/data/ef-mvc/crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ in ASP.NET Core 1.0, validation messages aren't rendered if `span` elements are
[!code-html[](intro/samples/cu/Views/Students/Create.cshtml?range=15-35&highlight=5,12,19)]

> [!NOTE]
> The 1.0.1 release of the scaffolding tooling generates explicitly closed span tags, but as of September, 2016, the 1.0.1 tooling is not included in the new-project templates. If you want to get the newer version of scaffolding code, you can update project.json to reference the "1.0.0-preview2-update1" release of two NuGet packages: "Microsoft.VisualStudio.Web.CodeGenerators.Mvc" and "Microsoft.VisualStudio.Web.Codegeneration.Tools".
> The 1.0.1 release of the scaffolding tooling generates explicitly closed span tags, but as of September, 2016, the 1.0.1 tooling is not included in the new-project templates. If you want to get the newer version of scaffolding code, you can update NuGet packages `Microsoft.VisualStudio.Web.CodeGenerators.Mvc` and `Microsoft.VisualStudio.Web.Codegeneration.Tools` to "1.0.0-preview2-update1".
Run the page by selecting the **Students** tab and clicking **Create New**.

Expand Down
12 changes: 3 additions & 9 deletions aspnetcore/fundamentals/dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,13 @@ With regards to data access specifically, you can inject the `DbContext` into yo

The built-in services container is meant to serve the basic needs of the framework and most consumer applications built on it. However, developers can replace the built-in container with their preferred container. The `ConfigureServices` method typically returns `void`, but if its signature is changed to return `IServiceProvider`, a different container can be configured and returned. There are many IOC containers available for .NET. In this example, the [Autofac](http://autofac.org/) package is used.

First, add the appropriate container package(s) to the dependencies property in `project.json`:
First, install the appropriate container package(s):

```json
"dependencies" : {
"Autofac": "4.0.0",
"Autofac.Extensions.DependencyInjection": "4.0.0"
},
```
* `Autofac`
* `Autofac.Extensions.DependencyInjection`

Next, configure the container in `ConfigureServices` and return an `IServiceProvider`:

<!-- literal_block {"ids": [], "linenos": false, "xml:space": "preserve", "language": "csharp", "highlight_args": {"hl_lines": [1, 11]}} -->

```csharp
public IServiceProvider ConfigureServices(IServiceCollection services)
{
Expand Down
14 changes: 1 addition & 13 deletions aspnetcore/fundamentals/owin.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,10 @@ ASP.NET Core supports the Open Web Interface for .NET (OWIN). OWIN allows web ap

## Running OWIN middleware in the ASP.NET pipeline

ASP.NET Core's OWIN support is deployed as part of the `Microsoft.AspNetCore.Owin` package. You can import OWIN support into your project by adding this package as a dependency in your *project.json* file:

<!-- literal_block {"ids": [], "names": [], "highlight_args": {"hl_lines": [4], "linenostart": 1}, "backrefs": [], "dupnames": [], "linenos": false, "classes": [], "xml:space": "preserve", "language": "javascript", "source": "/Users/shirhatti/src/Docs/aspnet/fundamentals/owin/sample/src/OwinSample/project.json"} -->

```javascript
"dependencies": {
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Owin": "1.0.0"
},
```
ASP.NET Core's OWIN support is deployed as part of the `Microsoft.AspNetCore.Owin` package. You can import OWIN support into your project by installing this package.

OWIN middleware conforms to the [OWIN specification](http://owin.org/spec/spec/owin-1.0.0.html), which requires a `Func<IDictionary<string, object>, Task>` interface, and specific keys be set (such as `owin.ResponseBody`). The following simple OWIN middleware displays "Hello World":

<!-- literal_block {"ids": [], "names": [], "highlight_args": {"linenostart": 1}, "backrefs": [], "dupnames": [], "linenos": false, "classes": [], "xml:space": "preserve", "language": "c#", "source": "/Users/shirhatti/src/Docs/aspnet/fundamentals/owin/sample/src/OwinSample/Startup.cs"} -->

```csharp
public Task OwinHello(IDictionary<string, object> environment)
{
Expand Down
4 changes: 1 addition & 3 deletions aspnetcore/migration/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ In the previous article we [migrated configuration from an ASP.NET MVC project t

In ASP.NET MVC, authentication and identity features are configured using ASP.NET Identity in Startup.Auth.cs and IdentityConfig.cs, located in the App_Start folder. In ASP.NET Core MVC, these features are configured in *Startup.cs*.

Add `Microsoft.AspNetCore.Identity.EntityFrameworkCore` and `Microsoft.AspNetCore.Authentication.Cookies` to the list of dependencies in project.json.
Install the `Microsoft.AspNetCore.Identity.EntityFrameworkCore` and `Microsoft.AspNetCore.Authentication.Cookies` NuGet packages.

Then, open Startup.cs and update the `ConfigureServices()` method to use Entity Framework and Identity services:

<!-- literal_block {"ids": [], "names": [], "highlight_args": {}, "backrefs": [], "dupnames": [], "linenos": false, "classes": [], "xml:space": "preserve", "language": "c#"} -->

```csharp
public void ConfigureServices(IServiceCollection services)
{
Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/mvc/models/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ services.AddMvc(options =>

## Configuring Formatters

If your application needs to support additional formats beyond the default of JSON, you can add these as additional dependencies in *project.json* and configure MVC to support them. There are separate formatters for input and output. Input formatters are used by [Model Binding](model-binding.md); output formatters are used to format responses. You can also configure [🔧 Custom Formatters](../advanced/custom-formatters.md).
If your application needs to support additional formats beyond the default of JSON, you can add NuGet packages and configure MVC to support them. There are separate formatters for input and output. Input formatters are used by [Model Binding](model-binding.md); output formatters are used to format responses. You can also configure [🔧 Custom Formatters](../advanced/custom-formatters.md).

### Adding XML Format Support

To add support for XML formatting, add the "Microsoft.AspNetCore.Mvc.Formatters.Xml" package to your *project.json*'s list of dependencies.
To add support for XML formatting, install the `Microsoft.AspNetCore.Mvc.Formatters.Xml` NuGet package.

Add the XmlSerializerFormatters to MVC's configuration in *Startup.cs*:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddMvc();

// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
// You will also need to install the Microsoft.AspNet.Mvc.WebApiCompatShim package.
// services.AddWebApiConventions();

services.Configure<IdentityOptions>(options =>
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/security/authentication/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ In this topic, you'll learn how to use ASP.NET Core Identity to add functionalit
The created project contains the `Microsoft.AspNetCore.Identity.EntityFrameworkCore` package, which will persist the identity data and schema to SQL Server using [Entity Framework Core](https://docs.efproject.net).

> [!NOTE]
>In Visual Studio, you can view NuGet packages details by selecting **Tools** -> **NuGet Package Manager** -> **Manage NuGet Packages for Solution**. You also see a list of packages in the dependencies section of the *project.json* file within your project.
>In Visual Studio, you can view NuGet packages details by selecting **Tools** -> **NuGet Package Manager** -> **Manage NuGet Packages for Solution**.
The identity services are added to the application in the `ConfigureServices` method in the `Startup` class:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ If EncryptionType is "Managed", the system will be configured to use a managed S
If EncryptionType has any other value (other than null / empty), the data protection system will throw an exception at startup.

>[!WARNING]
> When configuring a default policy setting that involves type names (EncryptionAlgorithmType, ValidationAlgorithmType, KeyEscrowSinks), the types must be available to the application. In practice, this means that for applications running on Desktop CLR, the assemblies which contain these types should be GACed. For ASP.NET Core applications running on [.NET Core](https://microsoft.com/net/core), the packages which contain these types should be referenced in project.json.
> When configuring a default policy setting that involves type names (EncryptionAlgorithmType, ValidationAlgorithmType, KeyEscrowSinks), the types must be available to the application. In practice, this means that for applications running on Desktop CLR, the assemblies which contain these types should be GACed. For ASP.NET Core applications running on [.NET Core](https://microsoft.com/net/core), the packages which contain these types should be installed.

0 comments on commit 2118ca4

Please sign in to comment.