diff options
author | Andon Andonov <andon.andonov@microsoft.com> | 2017-12-30 00:06:06 +0300 |
---|---|---|
committer | Andon Andonov <andon.andonov@microsoft.com> | 2017-12-30 00:06:06 +0300 |
commit | 54b943ca27dca7a637aff071a384e1fcc8eeec10 (patch) | |
tree | 86551060c2aa5cbff1a662b4a999cdcf39dc9292 /samples/WebApi | |
parent | d92565663125ec08b3bc000f2922af7c49a5f7d6 (diff) |
General cleanup, change package repository to official nuget and rephrase package reference paragraph
Diffstat (limited to 'samples/WebApi')
-rw-r--r-- | samples/WebApi/README.md | 16 | ||||
-rw-r--r-- | samples/WebApi/nuget.config | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/samples/WebApi/README.md b/samples/WebApi/README.md index 67684d828..c41af33df 100644 --- a/samples/WebApi/README.md +++ b/samples/WebApi/README.md @@ -12,7 +12,7 @@ If you're already familiar with .NET Core make sure you've [downloaded and insta Open a **new** shell/command prompt window and run the following commands. ``` -> dotnet new webapi -o myApp +> dotnet new webapi -o myApp > cd myApp ``` @@ -27,8 +27,8 @@ In your shell/command prompt navigate to the root directory of your project run This will add a nuget.config file to your application. Open the file and in the ``<packageSources> `` element under ``<clear/>`` add the following: ```xml -<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" /> -<add key="aspnet-core" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" /> +<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" /> +<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> ``` Once you've added the package source, add a reference to the compiler by running the following command: @@ -80,17 +80,17 @@ Once you've created a rd.xml file, navigate to the root directory of your projec where path_to_rdxml_file is the location of the file on your disk and runtime_identifier is one of win-x64, linux-x64 or osx-x64, depending on the OS for which you would like to publish. Under the second `<ItemGroup>` remove the line containing a reference to `Microsoft.AspNetCore.All` and substitute it with: ```xml -<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" /> -<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.0.1" /> +<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" /> +<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.0.1" /> ``` -This substitution removes unnecessary package references added by AspNetCore.All, which will reduce the size of your application's published binary files and avoid encountering unsupported features, as described in [the section above](#add-core-mvc-services) +This substitution removes unnecessary package references added by AspNetCore.All, which will remove them from your application's published files and avoid encountering unsupported features, as described in [the section above](#add-core-mvc-services) After you've modified your project's `.csproj` file, open your application's controller file (in the default template this should be called `ValuesController.cs`) and substitute the ValuesController class with the following: ```csharp -public class ValuesController +public class ValuesController { [HttpGet("/")] public string Hello() => "Hello World!"; @@ -106,7 +106,7 @@ public class ValuesController { return "Your value is " + id; } -} +} ``` (note the removed inheritance and [Route] directive). Also note that URL request paths are explicitly defined on each method. diff --git a/samples/WebApi/nuget.config b/samples/WebApi/nuget.config index 0e05ea83d..d8d3f2b01 100644 --- a/samples/WebApi/nuget.config +++ b/samples/WebApi/nuget.config @@ -4,6 +4,6 @@ <!--To inherit the global NuGet package sources remove the <clear/> line below --> <clear /> <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" /> - <add key="aspnet-core" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" /> + <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> </packageSources> </configuration> |