Skip to content

Commit

Permalink
Support for .NET 9 (#158)
Browse files Browse the repository at this point in the history
* Update target frameworks from net6.0 to net9.0
* Upgrade nuget packages
* Updated Opw.PineBlog.Sample to use top-level statements in Program.cs
* Update getting started documentation
* Updated Microsoft.Azure.Storage.Blob to Azure.Storage.Blobs and Microsoft.AspNetCore.Http.Abstractions to Microsoft.AspNetCore.App
* Update the build pipeline
* Update vunerable nuget packages
  • Loading branch information
petervandenhout authored Nov 29, 2024
1 parent ce99072 commit d6441ac
Show file tree
Hide file tree
Showing 58 changed files with 648 additions and 655 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/ofpinewood/pineblog</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions PineBlog.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
# Visual Studio Version 17
VisualStudioVersion = 17.12.35521.163 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00 Solution Files", "00 Solution Files", "{78B51317-E566-4217-BA48-A11D1756451D}"
ProjectSection(SolutionItems) = preProject
Expand Down
68 changes: 1 addition & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,73 +56,7 @@ The PineBlog core package. This package is a dependency for `Opw.PineBlog.RazorP
> For using MongoDb, see [Using MongoDb](https://github.com/ofpinewood/pineblog/tree/main/docs/mongodb.md) on how to setup that.
## Getting started
You add the PineBlog services and the Razor Pages UI in the Startup.cs of your application.

``` csharp
public void ConfigureServices(IServiceCollection services)
{
...
services.AddPineBlog(Configuration);

services.AddRazorPages().AddPineBlogRazorPages();
// or services.AddMvcCore().AddPineBlogRazorPages();
// or services.AddMvc().AddPineBlogRazorPages();
...
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{

// Make sure you enable static file serving
app.UseStaticFiles();

...
app.UseEndpoints(endpoints =>
{
// make sure to add the endpoint mapping for both RazorPages and Controllers
endpoints.MapRazorPages();
endpoints.MapControllers();
});
...
}
```

NOTE: Make sure you enable static file serving `app.UseStaticFiles();`, to enable the serving of the css and javascript from the `Opw.PineBlog.RazorPages` packages.

See [Customizing the layout](https://github.com/ofpinewood/pineblog/tree/main/docs/custom-layout.md) on how to setup the layout pages, css and javascript.

### Configuration
And a few properties need to be configured before you can run your web application with PineBlog.

``` json
{
"ConnectionStrings": {
"DefaultConnection": "Server=inMemory; Database=pineblog-db;"
},
"PineBlogOptions": {
"Title": "PineBlog",
"Description": "A blogging engine based on ASP.NET Core MVC Razor Pages and Entity Framework Core",
"ItemsPerPage": 5,
"CreateAndSeedDatabases": true,
"ConnectionStringName": "DefaultConnection",
"AzureStorageConnectionString": "UseDevelopmentStorage=true",
"AzureStorageBlobContainerName": "pineblog",
"FileBaseUrl": "http://127.0.0.1:10000/devstoreaccount1"
}
}
```

#### Blog Settings ConfigurationProvider
To be able to update the blog settings from the admin pages, you need to add the PineBlog `IConfigurationProvider`s to the
`IConfigurationBuilder` in the `Program.cs`. Add `config.AddPineBlogEntityFrameworkCoreConfiguration(reloadOnChange: true);` to `ConfigureAppConfiguration(..)` on the `IWebHostBuilder`.

``` csharp
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureAppConfiguration((hostingContext, config) => {
config.AddPineBlogEntityFrameworkCoreConfiguration(reloadOnChange: true);
});
```
See: [Getting started](https://github.com/ofpinewood/pineblog/tree/main/docs/getting-started.md)

## Documentation
For more information, please check the documentation.
Expand Down
Loading

0 comments on commit d6441ac

Please sign in to comment.