├── MessageBroker
├── appsettings.Development.json
├── appsettings.json
├── Models
│ ├── Topic.cs
│ ├── Subscription.cs
│ └── Message.cs
├── Data
│ └── AppDbContext.cs
├── MessageBroker.csproj
├── Properties
│ └── launchSettings.json
├── .vscode
│ ├── tasks.json
│ └── launch.json
├── Migrations
│ ├── AppDbContextModelSnapshot.cs
│ ├── 20230316204959_initialmigration.cs
│ └── 20230316204959_initialmigration.Designer.cs
└── Program.cs
├── Subscriber
├── Subscriber.csproj
├── Dtos
│ └── MessageReadDto.cs
├── .vscode
│ ├── launch.json
│ └── tasks.json
└── Program.cs
└── .gitignore
/MessageBroker/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/MessageBroker/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | },
8 | "AllowedHosts": "*"
9 | }
10 |
--------------------------------------------------------------------------------
/MessageBroker/Models/Topic.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace MessageBroker.Models
4 | {
5 | public class Topic
6 | {
7 | [Key]
8 | public int Id { get; set; }
9 |
10 | [Required]
11 | public string? Name { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Subscriber/Subscriber.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Subscriber/Dtos/MessageReadDto.cs:
--------------------------------------------------------------------------------
1 | namespace Subscriber.Dtos
2 | {
3 | public class MessageReadDto
4 | {
5 | public int Id { get; set; }
6 |
7 | public string? TopicMessage { get; set; }
8 |
9 | public DateTime ExpiresAfter { get; set; }
10 |
11 | public string? MessageStatus { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/MessageBroker/Models/Subscription.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace MessageBroker.Models
4 | {
5 | public class Subscription
6 | {
7 | [Key]
8 | public int Id { get; set; }
9 |
10 | [Required]
11 | public string? Name { get; set; }
12 |
13 | [Required]
14 | public int TopicId { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/MessageBroker/Data/AppDbContext.cs:
--------------------------------------------------------------------------------
1 | using MessageBroker.Models;
2 | using Microsoft.EntityFrameworkCore;
3 |
4 | namespace MessageBroker.Data
5 | {
6 | public class AppDbContext : DbContext
7 | {
8 | public AppDbContext(DbContextOptions options) : base(options)
9 | {
10 |
11 | }
12 |
13 | public DbSet Topics => Set();
14 | public DbSet Subscriptions => Set();
15 | public DbSet Messages => Set();
16 | }
17 | }
--------------------------------------------------------------------------------
/MessageBroker/Models/Message.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace MessageBroker.Models
4 | {
5 | public class Message
6 | {
7 | [Key]
8 | public int Id { get; set; }
9 |
10 | [Required]
11 | public string? TopicMessage { get; set; }
12 |
13 | public int SubscriptionId { get; set; }
14 |
15 | [Required]
16 | public DateTime ExpiresAfter { get; set; } = DateTime.Now.AddDays(1);
17 |
18 | [Required]
19 | public string MessageStatus { get; set; } = "NEW";
20 | }
21 | }
--------------------------------------------------------------------------------
/MessageBroker/MessageBroker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 | runtime; build; native; contentfiles; analyzers; buildtransitive
12 | all
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/MessageBroker/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:35835",
8 | "sslPort": 44351
9 | }
10 | },
11 | "profiles": {
12 | "MessageBroker": {
13 | "commandName": "Project",
14 | "dotnetRunMessages": true,
15 | "applicationUrl": "https://localhost:7269;http://localhost:5169",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "IIS Express": {
21 | "commandName": "IISExpress",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Subscriber/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | // Use IntelliSense to find out which attributes exist for C# debugging
6 | // Use hover for the description of the existing attributes
7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/bin/Debug/net6.0/Subscriber.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}",
16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach"
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/Subscriber/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/Subscriber.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/Subscriber.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/Subscriber.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/MessageBroker/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/MessageBroker.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/MessageBroker.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/MessageBroker.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/MessageBroker/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | // Use IntelliSense to find out which attributes exist for C# debugging
6 | // Use hover for the description of the existing attributes
7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8 | "name": ".NET Core Launch (web)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/bin/Debug/net6.0/MessageBroker.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}",
16 | "stopAtEntry": false,
17 | // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
18 | "serverReadyAction": {
19 | "action": "openExternally",
20 | "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
21 | },
22 | "env": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | },
25 | "sourceFileMap": {
26 | "/Views": "${workspaceFolder}/Views"
27 | }
28 | },
29 | {
30 | "name": ".NET Core Attach",
31 | "type": "coreclr",
32 | "request": "attach"
33 | }
34 | ]
35 | }
--------------------------------------------------------------------------------
/Subscriber/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http.Json;
2 | using Subscriber.Dtos;
3 |
4 |
5 | Console.WriteLine("Press ESC to stop");
6 | do
7 | {
8 | HttpClient client = new HttpClient();
9 | Console.WriteLine("Listening...");
10 | while(!Console.KeyAvailable)
11 | {
12 | List ackIds = await GetMessagesAsync(client);
13 |
14 | Thread.Sleep(2000);
15 |
16 | if(ackIds.Count > 0)
17 | {
18 | await AckMessagesAsync(client, ackIds);
19 | }
20 | }
21 |
22 | } while (Console.ReadKey(true).Key != ConsoleKey.Escape);
23 |
24 | static async Task> GetMessagesAsync(HttpClient httpClient)
25 | {
26 | List ackIds = new List();
27 | List? newMessages = new List();
28 |
29 | try
30 | {
31 | newMessages = await httpClient.GetFromJsonAsync>("https://localhost:7269/api/subscriptions/2/messages");
32 | }
33 | catch
34 | {
35 | return ackIds;
36 | }
37 |
38 | foreach(MessageReadDto msg in newMessages!)
39 | {
40 | Console.WriteLine($"{msg.Id} - {msg.TopicMessage} - {msg.MessageStatus}");
41 | ackIds.Add(msg.Id);
42 | }
43 |
44 | return ackIds;
45 | }
46 |
47 | static async Task AckMessagesAsync(HttpClient httpClient, List ackIds)
48 | {
49 | var response = await httpClient.PostAsJsonAsync("https://localhost:7269/api/subscriptions/2/messages", ackIds);
50 | var returnMessage = await response.Content.ReadAsStringAsync();
51 |
52 | Console.WriteLine(returnMessage);
53 | }
--------------------------------------------------------------------------------
/MessageBroker/Migrations/AppDbContextModelSnapshot.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using MessageBroker.Data;
4 | using Microsoft.EntityFrameworkCore;
5 | using Microsoft.EntityFrameworkCore.Infrastructure;
6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7 |
8 | #nullable disable
9 |
10 | namespace MessageBroker.Migrations
11 | {
12 | [DbContext(typeof(AppDbContext))]
13 | partial class AppDbContextModelSnapshot : ModelSnapshot
14 | {
15 | protected override void BuildModel(ModelBuilder modelBuilder)
16 | {
17 | #pragma warning disable 612, 618
18 | modelBuilder.HasAnnotation("ProductVersion", "7.0.4");
19 |
20 | modelBuilder.Entity("MessageBroker.Models.Message", b =>
21 | {
22 | b.Property("Id")
23 | .ValueGeneratedOnAdd()
24 | .HasColumnType("INTEGER");
25 |
26 | b.Property("ExpiresAfter")
27 | .HasColumnType("TEXT");
28 |
29 | b.Property("MessageStatus")
30 | .IsRequired()
31 | .HasColumnType("TEXT");
32 |
33 | b.Property("SubscriptionId")
34 | .HasColumnType("INTEGER");
35 |
36 | b.Property("TopicMessage")
37 | .IsRequired()
38 | .HasColumnType("TEXT");
39 |
40 | b.HasKey("Id");
41 |
42 | b.ToTable("Messages");
43 | });
44 |
45 | modelBuilder.Entity("MessageBroker.Models.Subscription", b =>
46 | {
47 | b.Property("Id")
48 | .ValueGeneratedOnAdd()
49 | .HasColumnType("INTEGER");
50 |
51 | b.Property("Name")
52 | .IsRequired()
53 | .HasColumnType("TEXT");
54 |
55 | b.Property("TopicId")
56 | .HasColumnType("INTEGER");
57 |
58 | b.HasKey("Id");
59 |
60 | b.ToTable("Subscriptions");
61 | });
62 |
63 | modelBuilder.Entity("MessageBroker.Models.Topic", b =>
64 | {
65 | b.Property("Id")
66 | .ValueGeneratedOnAdd()
67 | .HasColumnType("INTEGER");
68 |
69 | b.Property("Name")
70 | .IsRequired()
71 | .HasColumnType("TEXT");
72 |
73 | b.HasKey("Id");
74 |
75 | b.ToTable("Topics");
76 | });
77 | #pragma warning restore 612, 618
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/MessageBroker/Migrations/20230316204959_initialmigration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 |
4 | #nullable disable
5 |
6 | namespace MessageBroker.Migrations
7 | {
8 | ///
9 | public partial class initialmigration : Migration
10 | {
11 | ///
12 | protected override void Up(MigrationBuilder migrationBuilder)
13 | {
14 | migrationBuilder.CreateTable(
15 | name: "Messages",
16 | columns: table => new
17 | {
18 | Id = table.Column(type: "INTEGER", nullable: false)
19 | .Annotation("Sqlite:Autoincrement", true),
20 | TopicMessage = table.Column(type: "TEXT", nullable: false),
21 | SubscriptionId = table.Column(type: "INTEGER", nullable: false),
22 | ExpiresAfter = table.Column(type: "TEXT", nullable: false),
23 | MessageStatus = table.Column(type: "TEXT", nullable: false)
24 | },
25 | constraints: table =>
26 | {
27 | table.PrimaryKey("PK_Messages", x => x.Id);
28 | });
29 |
30 | migrationBuilder.CreateTable(
31 | name: "Subscriptions",
32 | columns: table => new
33 | {
34 | Id = table.Column(type: "INTEGER", nullable: false)
35 | .Annotation("Sqlite:Autoincrement", true),
36 | Name = table.Column(type: "TEXT", nullable: false),
37 | TopicId = table.Column(type: "INTEGER", nullable: false)
38 | },
39 | constraints: table =>
40 | {
41 | table.PrimaryKey("PK_Subscriptions", x => x.Id);
42 | });
43 |
44 | migrationBuilder.CreateTable(
45 | name: "Topics",
46 | columns: table => new
47 | {
48 | Id = table.Column(type: "INTEGER", nullable: false)
49 | .Annotation("Sqlite:Autoincrement", true),
50 | Name = table.Column(type: "TEXT", nullable: false)
51 | },
52 | constraints: table =>
53 | {
54 | table.PrimaryKey("PK_Topics", x => x.Id);
55 | });
56 | }
57 |
58 | ///
59 | protected override void Down(MigrationBuilder migrationBuilder)
60 | {
61 | migrationBuilder.DropTable(
62 | name: "Messages");
63 |
64 | migrationBuilder.DropTable(
65 | name: "Subscriptions");
66 |
67 | migrationBuilder.DropTable(
68 | name: "Topics");
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/MessageBroker/Migrations/20230316204959_initialmigration.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using MessageBroker.Data;
4 | using Microsoft.EntityFrameworkCore;
5 | using Microsoft.EntityFrameworkCore.Infrastructure;
6 | using Microsoft.EntityFrameworkCore.Migrations;
7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8 |
9 | #nullable disable
10 |
11 | namespace MessageBroker.Migrations
12 | {
13 | [DbContext(typeof(AppDbContext))]
14 | [Migration("20230316204959_initialmigration")]
15 | partial class initialmigration
16 | {
17 | ///
18 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
19 | {
20 | #pragma warning disable 612, 618
21 | modelBuilder.HasAnnotation("ProductVersion", "7.0.4");
22 |
23 | modelBuilder.Entity("MessageBroker.Models.Message", b =>
24 | {
25 | b.Property("Id")
26 | .ValueGeneratedOnAdd()
27 | .HasColumnType("INTEGER");
28 |
29 | b.Property("ExpiresAfter")
30 | .HasColumnType("TEXT");
31 |
32 | b.Property("MessageStatus")
33 | .IsRequired()
34 | .HasColumnType("TEXT");
35 |
36 | b.Property("SubscriptionId")
37 | .HasColumnType("INTEGER");
38 |
39 | b.Property("TopicMessage")
40 | .IsRequired()
41 | .HasColumnType("TEXT");
42 |
43 | b.HasKey("Id");
44 |
45 | b.ToTable("Messages");
46 | });
47 |
48 | modelBuilder.Entity("MessageBroker.Models.Subscription", b =>
49 | {
50 | b.Property("Id")
51 | .ValueGeneratedOnAdd()
52 | .HasColumnType("INTEGER");
53 |
54 | b.Property("Name")
55 | .IsRequired()
56 | .HasColumnType("TEXT");
57 |
58 | b.Property("TopicId")
59 | .HasColumnType("INTEGER");
60 |
61 | b.HasKey("Id");
62 |
63 | b.ToTable("Subscriptions");
64 | });
65 |
66 | modelBuilder.Entity("MessageBroker.Models.Topic", b =>
67 | {
68 | b.Property("Id")
69 | .ValueGeneratedOnAdd()
70 | .HasColumnType("INTEGER");
71 |
72 | b.Property("Name")
73 | .IsRequired()
74 | .HasColumnType("TEXT");
75 |
76 | b.HasKey("Id");
77 |
78 | b.ToTable("Topics");
79 | });
80 | #pragma warning restore 612, 618
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/MessageBroker/Program.cs:
--------------------------------------------------------------------------------
1 | using MessageBroker.Data;
2 | using MessageBroker.Models;
3 | using Microsoft.EntityFrameworkCore;
4 |
5 | var builder = WebApplication.CreateBuilder(args);
6 |
7 | builder.Services.AddDbContext(opt => opt.UseSqlite("Data Source=MessageBroker.db"));
8 |
9 | var app = builder.Build();
10 |
11 | app.UseHttpsRedirection();
12 |
13 | // Create Topic
14 | app.MapPost("api/topics", async (AppDbContext context, Topic topic) =>
15 | {
16 | await context.Topics.AddAsync(topic);
17 |
18 | await context.SaveChangesAsync();
19 |
20 | return Results.Created($"api/topics/{topic.Id}", topic);
21 | });
22 |
23 | // Return all topics
24 | app.MapGet("api/topics", async (AppDbContext context) =>
25 | {
26 | var topics = await context.Topics.ToListAsync();
27 |
28 | return Results.Ok(topics);
29 | });
30 |
31 | // Publish Message
32 | app.MapPost("api/topics/{id}/messages", async (AppDbContext context, int id, Message message) =>
33 | {
34 | bool topics = await context.Topics.AnyAsync(t => t.Id == id);
35 | if (!topics)
36 | return Results.NotFound("Topic not found");
37 |
38 | var subs = context.Subscriptions.Where(s => s.TopicId == id);
39 |
40 | if (subs.Count() == 0)
41 | return Results.NotFound("There are no subscriptions for this topic");
42 |
43 | foreach (var sub in subs)
44 | {
45 | Message msg = new Message
46 | {
47 | TopicMessage = message.TopicMessage,
48 | SubscriptionId = sub.Id,
49 | ExpiresAfter = message.ExpiresAfter,
50 | MessageStatus = message.MessageStatus
51 | };
52 | await context.Messages.AddAsync(msg);
53 | }
54 | await context.SaveChangesAsync();
55 |
56 | return Results.Ok("Message has been published");
57 | });
58 |
59 | // Create Subscription
60 | app.MapPost("api/topics/{id}/subscriptions", async (AppDbContext context, int id, Subscription sub) =>
61 | {
62 | bool topics = await context.Topics.AnyAsync(t => t.Id == id);
63 | if (!topics)
64 | return Results.NotFound("Topic not found");
65 |
66 | sub.TopicId = id;
67 |
68 | await context.Subscriptions.AddAsync(sub);
69 | await context.SaveChangesAsync();
70 |
71 | return Results.Created($"api/topics/{id}/subscriptions/{sub.Id}", sub);
72 |
73 | });
74 |
75 | // Get Subscriber Messages
76 | app.MapGet("api/subscriptions/{id}/messages", async (AppDbContext context, int id) =>
77 | {
78 | bool subs = await context.Subscriptions.AnyAsync(s => s.Id == id);
79 | if (!subs)
80 | return Results.NotFound("Subscription not found");
81 |
82 | var messages = context.Messages.Where(m => m.SubscriptionId == id && m.MessageStatus != "SENT");
83 | if (messages.Count() == 0)
84 | return Results.NotFound("No new messages");
85 |
86 | foreach (var msg in messages)
87 | {
88 | msg.MessageStatus = "REQUESTED";
89 | }
90 |
91 | await context.SaveChangesAsync();
92 |
93 | return Results.Ok(messages);
94 |
95 | });
96 |
97 | // Ack Messages for Subscriber
98 | app.MapPost("api/subscriptions/{id}/messages", async (AppDbContext context, int id, int[] confs) =>
99 | {
100 | bool subs = await context.Subscriptions.AnyAsync(s => s.Id == id);
101 | if (!subs)
102 | return Results.NotFound("Subscription not found");
103 |
104 | if(confs.Length <= 0)
105 | return Results.BadRequest();
106 |
107 | int count = 0;
108 | foreach(int i in confs)
109 | {
110 | var msg = context.Messages.FirstOrDefault(m => m.Id == i);
111 |
112 | if (msg != null)
113 | {
114 | msg.MessageStatus = "SENT";
115 | await context.SaveChangesAsync();
116 | count++;
117 | }
118 | }
119 | return Results.Ok($"Acknowledged {count}/{confs.Length} messages");
120 | });
121 |
122 | app.Run();
123 |
124 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # SQLite
14 | *.db
15 |
16 | # User-specific files (MonoDevelop/Xamarin Studio)
17 | *.userprefs
18 |
19 | # Mono auto generated files
20 | mono_crash.*
21 |
22 | # Build results
23 | [Dd]ebug/
24 | [Dd]ebugPublic/
25 | [Rr]elease/
26 | [Rr]eleases/
27 | x64/
28 | x86/
29 | [Ww][Ii][Nn]32/
30 | [Aa][Rr][Mm]/
31 | [Aa][Rr][Mm]64/
32 | bld/
33 | [Bb]in/
34 | [Oo]bj/
35 | [Ll]og/
36 | [Ll]ogs/
37 |
38 | # Visual Studio 2015/2017 cache/options directory
39 | .vs/
40 | # Uncomment if you have tasks that create the project's static files in wwwroot
41 | #wwwroot/
42 |
43 | # Visual Studio 2017 auto generated files
44 | Generated\ Files/
45 |
46 | # MSTest test Results
47 | [Tt]est[Rr]esult*/
48 | [Bb]uild[Ll]og.*
49 |
50 | # NUnit
51 | *.VisualState.xml
52 | TestResult.xml
53 | nunit-*.xml
54 |
55 | # Build Results of an ATL Project
56 | [Dd]ebugPS/
57 | [Rr]eleasePS/
58 | dlldata.c
59 |
60 | # Benchmark Results
61 | BenchmarkDotNet.Artifacts/
62 |
63 | # .NET
64 | project.lock.json
65 | project.fragment.lock.json
66 | artifacts/
67 |
68 | # Tye
69 | .tye/
70 |
71 | # ASP.NET Scaffolding
72 | ScaffoldingReadMe.txt
73 |
74 | # StyleCop
75 | StyleCopReport.xml
76 |
77 | # Files built by Visual Studio
78 | *_i.c
79 | *_p.c
80 | *_h.h
81 | *.ilk
82 | *.meta
83 | *.obj
84 | *.iobj
85 | *.pch
86 | *.pdb
87 | *.ipdb
88 | *.pgc
89 | *.pgd
90 | *.rsp
91 | *.sbr
92 | *.tlb
93 | *.tli
94 | *.tlh
95 | *.tmp
96 | *.tmp_proj
97 | *_wpftmp.csproj
98 | *.log
99 | *.vspscc
100 | *.vssscc
101 | .builds
102 | *.pidb
103 | *.svclog
104 | *.scc
105 |
106 | # Chutzpah Test files
107 | _Chutzpah*
108 |
109 | # Visual C++ cache files
110 | ipch/
111 | *.aps
112 | *.ncb
113 | *.opendb
114 | *.opensdf
115 | *.sdf
116 | *.cachefile
117 | *.VC.db
118 | *.VC.VC.opendb
119 |
120 | # Visual Studio profiler
121 | *.psess
122 | *.vsp
123 | *.vspx
124 | *.sap
125 |
126 | # Visual Studio Trace Files
127 | *.e2e
128 |
129 | # TFS 2012 Local Workspace
130 | $tf/
131 |
132 | # Guidance Automation Toolkit
133 | *.gpState
134 |
135 | # ReSharper is a .NET coding add-in
136 | _ReSharper*/
137 | *.[Rr]e[Ss]harper
138 | *.DotSettings.user
139 |
140 | # TeamCity is a build add-in
141 | _TeamCity*
142 |
143 | # DotCover is a Code Coverage Tool
144 | *.dotCover
145 |
146 | # AxoCover is a Code Coverage Tool
147 | .axoCover/*
148 | !.axoCover/settings.json
149 |
150 | # Coverlet is a free, cross platform Code Coverage Tool
151 | coverage*.json
152 | coverage*.xml
153 | coverage*.info
154 |
155 | # Visual Studio code coverage results
156 | *.coverage
157 | *.coveragexml
158 |
159 | # NCrunch
160 | _NCrunch_*
161 | .*crunch*.local.xml
162 | nCrunchTemp_*
163 |
164 | # MightyMoose
165 | *.mm.*
166 | AutoTest.Net/
167 |
168 | # Web workbench (sass)
169 | .sass-cache/
170 |
171 | # Installshield output folder
172 | [Ee]xpress/
173 |
174 | # DocProject is a documentation generator add-in
175 | DocProject/buildhelp/
176 | DocProject/Help/*.HxT
177 | DocProject/Help/*.HxC
178 | DocProject/Help/*.hhc
179 | DocProject/Help/*.hhk
180 | DocProject/Help/*.hhp
181 | DocProject/Help/Html2
182 | DocProject/Help/html
183 |
184 | # Click-Once directory
185 | publish/
186 |
187 | # Publish Web Output
188 | *.[Pp]ublish.xml
189 | *.azurePubxml
190 | # Note: Comment the next line if you want to checkin your web deploy settings,
191 | # but database connection strings (with potential passwords) will be unencrypted
192 | *.pubxml
193 | *.publishproj
194 |
195 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
196 | # checkin your Azure Web App publish settings, but sensitive information contained
197 | # in these scripts will be unencrypted
198 | PublishScripts/
199 |
200 | # NuGet Packages
201 | *.nupkg
202 | # NuGet Symbol Packages
203 | *.snupkg
204 | # The packages folder can be ignored because of Package Restore
205 | **/[Pp]ackages/*
206 | # except build/, which is used as an MSBuild target.
207 | !**/[Pp]ackages/build/
208 | # Uncomment if necessary however generally it will be regenerated when needed
209 | #!**/[Pp]ackages/repositories.config
210 | # NuGet v3's project.json files produces more ignorable files
211 | *.nuget.props
212 | *.nuget.targets
213 |
214 | # Microsoft Azure Build Output
215 | csx/
216 | *.build.csdef
217 |
218 | # Microsoft Azure Emulator
219 | ecf/
220 | rcf/
221 |
222 | # Windows Store app package directories and files
223 | AppPackages/
224 | BundleArtifacts/
225 | Package.StoreAssociation.xml
226 | _pkginfo.txt
227 | *.appx
228 | *.appxbundle
229 | *.appxupload
230 |
231 | # Visual Studio cache files
232 | # files ending in .cache can be ignored
233 | *.[Cc]ache
234 | # but keep track of directories ending in .cache
235 | !?*.[Cc]ache/
236 |
237 | # Others
238 | ClientBin/
239 | ~$*
240 | *~
241 | *.dbmdl
242 | *.dbproj.schemaview
243 | *.jfm
244 | *.pfx
245 | *.publishsettings
246 | orleans.codegen.cs
247 |
248 | # Including strong name files can present a security risk
249 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
250 | #*.snk
251 |
252 | # Since there are multiple workflows, uncomment next line to ignore bower_components
253 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
254 | #bower_components/
255 |
256 | # RIA/Silverlight projects
257 | Generated_Code/
258 |
259 | # Backup & report files from converting an old project file
260 | # to a newer Visual Studio version. Backup files are not needed,
261 | # because we have git ;-)
262 | _UpgradeReport_Files/
263 | Backup*/
264 | UpgradeLog*.XML
265 | UpgradeLog*.htm
266 | ServiceFabricBackup/
267 | *.rptproj.bak
268 |
269 | # SQL Server files
270 | *.mdf
271 | *.ldf
272 | *.ndf
273 |
274 | # Business Intelligence projects
275 | *.rdl.data
276 | *.bim.layout
277 | *.bim_*.settings
278 | *.rptproj.rsuser
279 | *- [Bb]ackup.rdl
280 | *- [Bb]ackup ([0-9]).rdl
281 | *- [Bb]ackup ([0-9][0-9]).rdl
282 |
283 | # Microsoft Fakes
284 | FakesAssemblies/
285 |
286 | # GhostDoc plugin setting file
287 | *.GhostDoc.xml
288 |
289 | # Node.js Tools for Visual Studio
290 | .ntvs_analysis.dat
291 | node_modules/
292 |
293 | # Visual Studio 6 build log
294 | *.plg
295 |
296 | # Visual Studio 6 workspace options file
297 | *.opt
298 |
299 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
300 | *.vbw
301 |
302 | # Visual Studio LightSwitch build output
303 | **/*.HTMLClient/GeneratedArtifacts
304 | **/*.DesktopClient/GeneratedArtifacts
305 | **/*.DesktopClient/ModelManifest.xml
306 | **/*.Server/GeneratedArtifacts
307 | **/*.Server/ModelManifest.xml
308 | _Pvt_Extensions
309 |
310 | # Paket dependency manager
311 | .paket/paket.exe
312 | paket-files/
313 |
314 | # FAKE - F# Make
315 | .fake/
316 |
317 | # CodeRush personal settings
318 | .cr/personal
319 |
320 | # Python Tools for Visual Studio (PTVS)
321 | __pycache__/
322 | *.pyc
323 |
324 | # Cake - Uncomment if you are using it
325 | # tools/**
326 | # !tools/packages.config
327 |
328 | # Tabs Studio
329 | *.tss
330 |
331 | # Telerik's JustMock configuration file
332 | *.jmconfig
333 |
334 | # BizTalk build output
335 | *.btp.cs
336 | *.btm.cs
337 | *.odx.cs
338 | *.xsd.cs
339 |
340 | # OpenCover UI analysis results
341 | OpenCover/
342 |
343 | # Azure Stream Analytics local run output
344 | ASALocalRun/
345 |
346 | # MSBuild Binary and Structured Log
347 | *.binlog
348 |
349 | # NVidia Nsight GPU debugger configuration file
350 | *.nvuser
351 |
352 | # MFractors (Xamarin productivity tool) working folder
353 | .mfractor/
354 |
355 | # Local History for Visual Studio
356 | .localhistory/
357 |
358 | # BeatPulse healthcheck temp database
359 | healthchecksdb
360 |
361 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
362 | MigrationBackup/
363 |
364 | # Ionide (cross platform F# VS Code tools) working folder
365 | .ionide/
366 |
367 | # Fody - auto-generated XML schema
368 | FodyWeavers.xsd
369 |
370 | ##
371 | ## Visual studio for Mac
372 | ##
373 |
374 |
375 | # globs
376 | Makefile.in
377 | *.userprefs
378 | *.usertasks
379 | config.make
380 | config.status
381 | aclocal.m4
382 | install-sh
383 | autom4te.cache/
384 | *.tar.gz
385 | tarballs/
386 | test-results/
387 |
388 | # Mac bundle stuff
389 | *.dmg
390 | *.app
391 |
392 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
393 | # General
394 | .DS_Store
395 | .AppleDouble
396 | .LSOverride
397 |
398 | # Icon must end with two \r
399 | Icon
400 |
401 |
402 | # Thumbnails
403 | ._*
404 |
405 | # Files that might appear in the root of a volume
406 | .DocumentRevisions-V100
407 | .fseventsd
408 | .Spotlight-V100
409 | .TemporaryItems
410 | .Trashes
411 | .VolumeIcon.icns
412 | .com.apple.timemachine.donotpresent
413 |
414 | # Directories potentially created on remote AFP share
415 | .AppleDB
416 | .AppleDesktop
417 | Network Trash Folder
418 | Temporary Items
419 | .apdisk
420 |
421 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
422 | # Windows thumbnail cache files
423 | Thumbs.db
424 | ehthumbs.db
425 | ehthumbs_vista.db
426 |
427 | # Dump file
428 | *.stackdump
429 |
430 | # Folder config file
431 | [Dd]esktop.ini
432 |
433 | # Recycle Bin used on file shares
434 | $RECYCLE.BIN/
435 |
436 | # Windows Installer files
437 | *.cab
438 | *.msi
439 | *.msix
440 | *.msm
441 | *.msp
442 |
443 | # Windows shortcuts
444 | *.lnk
445 |
446 | # JetBrains Rider
447 | .idea/
448 | *.sln.iml
449 |
450 | ##
451 | ## Visual Studio Code
452 | ##
453 | .vscode/*
454 | !.vscode/settings.json
455 | !.vscode/tasks.json
456 | !.vscode/launch.json
457 | !.vscode/extensions.json
458 |
--------------------------------------------------------------------------------