Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated projects to .NET 8 and updated references to the latest versi… #793

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions BaGet.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.29104.9
# Visual Studio Version 17
VisualStudioVersion = 17.8.34525.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet", "src\BaGet\BaGet.csproj", "{284366CB-C68F-473E-908A-50A382616AE0}"
EndProject
Expand All @@ -28,6 +28,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
src\Directory.Build.props = src\Directory.Build.props
nuget.config = nuget.config
readme.md = readme.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Web", "src\BaGet.Web\BaGet.Web.csproj", "{D68B56AC-98DD-4DA7-B4F8-1243538A8A5C}"
Expand All @@ -44,13 +45,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Gcp", "src\BaGet.Gcp\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DDEC0736-8169-4834-815E-B78E7CE612A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.WindowsService", "samples\BaGet.WindowsService\BaGet.WindowsService.csproj", "{23499726-386A-4036-BF68-3A98E6913919}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGetWebApplication", "samples\BaGetWebApplication\BaGetWebApplication.csproj", "{E5AFE55D-0932-46A9-BFA3-C8A034037377}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Protocol.Samples.Tests", "samples\BaGet.Protocol.Samples.Tests\BaGet.Protocol.Samples.Tests.csproj", "{16B0D424-BB2F-4C0C-90B0-4F7955326ADF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Aliyun", "src\BaGet.Aliyun\BaGet.Aliyun.csproj", "{9F7C4F38-D598-42D9-A9F8-962490483B18}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGetWebApplication", "samples\BaGetWebApplication\BaGetWebApplication.csproj", "{E5AFE55D-0932-46A9-BFA3-C8A034037377}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaGet.Web.Tests", "tests\BaGet.Web.Tests\BaGet.Web.Tests.csproj", "{BEEAAA73-36CD-4178-9C9F-6D036586E7BF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaGet.Web.Tests", "tests\BaGet.Web.Tests\BaGet.Web.Tests.csproj", "{BEEAAA73-36CD-4178-9C9F-6D036586E7BF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaGet.LinuxService", "samples\BaGet.LinuxService\BaGet.LinuxService.csproj", "{BC72AB9B-FDAA-49D7-8B45-3B40F3E536F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -114,6 +119,14 @@ Global
{D7D60BA0-FF7F-4B37-815C-74D487C5176E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7D60BA0-FF7F-4B37-815C-74D487C5176E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7D60BA0-FF7F-4B37-815C-74D487C5176E}.Release|Any CPU.Build.0 = Release|Any CPU
{23499726-386A-4036-BF68-3A98E6913919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23499726-386A-4036-BF68-3A98E6913919}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23499726-386A-4036-BF68-3A98E6913919}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23499726-386A-4036-BF68-3A98E6913919}.Release|Any CPU.Build.0 = Release|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Release|Any CPU.Build.0 = Release|Any CPU
{16B0D424-BB2F-4C0C-90B0-4F7955326ADF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16B0D424-BB2F-4C0C-90B0-4F7955326ADF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16B0D424-BB2F-4C0C-90B0-4F7955326ADF}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -122,14 +135,14 @@ Global
{9F7C4F38-D598-42D9-A9F8-962490483B18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F7C4F38-D598-42D9-A9F8-962490483B18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F7C4F38-D598-42D9-A9F8-962490483B18}.Release|Any CPU.Build.0 = Release|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5AFE55D-0932-46A9-BFA3-C8A034037377}.Release|Any CPU.Build.0 = Release|Any CPU
{BEEAAA73-36CD-4178-9C9F-6D036586E7BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEEAAA73-36CD-4178-9C9F-6D036586E7BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEEAAA73-36CD-4178-9C9F-6D036586E7BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEEAAA73-36CD-4178-9C9F-6D036586E7BF}.Release|Any CPU.Build.0 = Release|Any CPU
{BC72AB9B-FDAA-49D7-8B45-3B40F3E536F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC72AB9B-FDAA-49D7-8B45-3B40F3E536F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC72AB9B-FDAA-49D7-8B45-3B40F3E536F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC72AB9B-FDAA-49D7-8B45-3B40F3E536F5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -149,10 +162,12 @@ Global
{A4375529-E855-4D46-AA4F-B3FE630C3DE1} = {26A0B557-53FB-4B9A-94C4-BCCF1BDCB0CC}
{F48F201A-4DEE-4D5B-9C0B-59490FE942FA} = {26A0B557-53FB-4B9A-94C4-BCCF1BDCB0CC}
{D7D60BA0-FF7F-4B37-815C-74D487C5176E} = {26A0B557-53FB-4B9A-94C4-BCCF1BDCB0CC}
{23499726-386A-4036-BF68-3A98E6913919} = {DDEC0736-8169-4834-815E-B78E7CE612A4}
{E5AFE55D-0932-46A9-BFA3-C8A034037377} = {DDEC0736-8169-4834-815E-B78E7CE612A4}
{16B0D424-BB2F-4C0C-90B0-4F7955326ADF} = {DDEC0736-8169-4834-815E-B78E7CE612A4}
{9F7C4F38-D598-42D9-A9F8-962490483B18} = {26A0B557-53FB-4B9A-94C4-BCCF1BDCB0CC}
{E5AFE55D-0932-46A9-BFA3-C8A034037377} = {DDEC0736-8169-4834-815E-B78E7CE612A4}
{BEEAAA73-36CD-4178-9C9F-6D036586E7BF} = {C237857D-AD8E-4C52-974F-6A8155BB0C18}
{BC72AB9B-FDAA-49D7-8B45-3B40F3E536F5} = {DDEC0736-8169-4834-815E-B78E7CE612A4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1423C027-2C90-417F-8629-2A4CF107C055}
Expand Down
32 changes: 32 additions & 0 deletions samples/BaGet.LinuxService/BaGet.LinuxService.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-BaGet.LinuxService-d749ca94-aab4-4d12-9a0a-b631d6144c5e</UserSecretsId>
<AssemblyName>BaGet</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\BaGet.Aliyun\BaGet.Aliyun.csproj" />
<ProjectReference Include="..\..\src\BaGet.Aws\BaGet.Aws.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.MySql\BaGet.Database.MySql.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.PostgreSql\BaGet.Database.PostgreSql.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.Sqlite\BaGet.Database.Sqlite.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.SqlServer\BaGet.Database.SqlServer.csproj" />
<ProjectReference Include="..\..\src\BaGet.Gcp\BaGet.Gcp.csproj" />
<ProjectReference Include="..\..\src\BaGet.Web\BaGet.Web.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="baget.service">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
43 changes: 43 additions & 0 deletions samples/BaGet.LinuxService/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using BaGet.Web;

namespace BaGet.LinuxService
{
public class Program
{
public static void Main(string[] args)
{
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureAppConfiguration((ctx, config) =>
{
var root = Environment.GetEnvironmentVariable("BAGET_CONFIG_ROOT");

if (!string.IsNullOrEmpty(root))
{
config.SetBasePath(root);
}
});
builder.ConfigureWebHostDefaults(web =>
{
web.ConfigureKestrel(options =>
{
// Remove the upload limit from Kestrel. If needed, an upload limit can
// be enforced by a reverse proxy server, like IIS.
options.Limits.MaxRequestBodySize = null;
});

web.UseStartup<Startup>();
});
builder.UseSystemd();

var host = builder.Build();
if (!host.ValidateStartupOptions())
{
return;
}

host.RunMigrationsAsync().Wait();
host.RunAsync().Wait();
}

}
}
14 changes: 14 additions & 0 deletions samples/BaGet.LinuxService/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"BaGet.LinuxService": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}
38 changes: 38 additions & 0 deletions samples/BaGet.LinuxService/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# BaGet service for Linux

This is the BaGet light weight NuGet server built as a Linux service.

## Building for Linux

To build for your Linux platform:

* Create a new Publishing Profile
* Select FolderProfile
* Set the Target Runtime to the required Linux runtime
* Publish.

This will create an application that can be directly run on Linux.
That is you can directly call ./BaGet on the target Linux architecture
and the service will start in the same way that it starts from the
commandline in Windows or in the Visual Studio debugger.

## Installation

Installation of BaGet on Linux comprises the following steps:

* Copy the BaGet build to /usr/share/baget
* Make the BaGet application executable
* Edit the appsettings.json to your needs
* Edit /usr/share/baget/baget.service to your needs
* Copy the baget.service file to /etc/systemd/system/baget.service
* Enable the baget service
* Start the baget service

```
$chmod 0755 /usr/share/baget/BaGet
$vi /usr/share/baget/appsettings.json
$vi /usr/share/baget/baget.service
$sudo cp /usr/share/baget/baget.service /etc/systemd/system/baget.service
$sudo systemctl enable baget
$sudo systemctl start baget
```
37 changes: 37 additions & 0 deletions samples/BaGet.LinuxService/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace BaGet.LinuxService
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddBaGetWebApplication(app =>
{
//app.AddMySqlDatabase();
//app.AddPostgreSqlDatabase();
// Use SQLite as BaGet's database and store packages on the local file system.
app.AddSqliteDatabase();
//app.AddSqlServerDatabase();
app.AddFileStorage();
});
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseStaticFiles();
app.UseRouting();

app.UseEndpoints(endpoints =>
{
// Add BaGet's endpoints.
var baget = new BaGetEndpointBuilder();

baget.MapEndpoints(endpoints);
});
}
}
}
8 changes: 8 additions & 0 deletions samples/BaGet.LinuxService/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
52 changes: 52 additions & 0 deletions samples/BaGet.LinuxService/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"ApiKey": "",
"PackageDeletionBehavior": "Unlist",
"AllowPackageOverwrites": false,

"Database": {
"Type": "Sqlite",
"ConnectionString": "Data Source=/home/baget/baget.db"
},

"Storage": {
"Type": "FileSystem",
// "Path": ""
"Path": "/home/baget"
},

"Search": {
"Type": "Database"
},

"Mirror": {
// Enabling mirror will ensure that all packages used are copied to the local server
"Enabled": true,

// Uncomment this to use the NuGet v2 protocol
//"Legacy": true,
"PackageSource": "https://api.nuget.org/v3/index.json"
},

// Uncomment this to configure BaGet to listen to port 8080.
// See: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1#listenoptionsusehttps
//"Kestrel": {
// "Endpoints": {
// "Http": {
// "Url": "http://localhost:8080"
// }
// }
//},

"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
},
"Console": {
"LogLevel": {
"Microsoft.Hosting.Lifetime": "Information",
"Default": "Warning"
}
}
}
}
17 changes: 17 additions & 0 deletions samples/BaGet.LinuxService/baget.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=BaGet A lightweight NuGet and symbol server.
After=network.target
StartLimitIntervalSec=10

[Service]
Environment="BAGET_CONFIG_ROOT=/usr/share/baget"
WorkingDirectory=/usr/share/baget/
Type=notify
ExecStart=/usr/share/baget/BaGet
Restart=always
RestartSec=1
User=baget
Group=baget

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<NoWarn>IDE0007</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0-preview-24080-01" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
27 changes: 27 additions & 0 deletions samples/BaGet.WindowsService/BaGet.WindowsService.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-BaGet.WindowsService-677f9d1a-910f-405d-9064-cb101e6abcea</UserSecretsId>
<AssemblyName>BaGet</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\BaGet.Aliyun\BaGet.Aliyun.csproj" />
<ProjectReference Include="..\..\src\BaGet.Aws\BaGet.Aws.csproj" />
<ProjectReference Include="..\..\src\BaGet.Azure\BaGet.Azure.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.MySql\BaGet.Database.MySql.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.PostgreSql\BaGet.Database.PostgreSql.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.Sqlite\BaGet.Database.Sqlite.csproj" />
<ProjectReference Include="..\..\src\BaGet.Database.SqlServer\BaGet.Database.SqlServer.csproj" />
<ProjectReference Include="..\..\src\BaGet.Gcp\BaGet.Gcp.csproj" />
<ProjectReference Include="..\..\src\BaGet.Web\BaGet.Web.csproj" />
</ItemGroup>
</Project>
Loading