版权

版权 通常,.NET 基金会中项目的版权声明如下: “Copyright (c) .NET Foundation and Contributors. All Rights Reserved”. 版权声明应放在项目的 LICENSE 文件中,因此 MIT 许可项目的 LICENSE 开头如下: The MIT License (MIT) Copyright (c) .NET Foundation and Contributors All Rights Reserved Permission is hereby granted... Apache 2.0 许可项目的 LICENSE 则以如下内容开头: Copyright (c) .NET Foundation and Contributors All Rights Reserved Apache License, Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions... 在项目中引入第三方开源代码时,任何第三方的版权声明都应随代码一起保留。一种很好的做法是,把项目中需要展示的第三方声明汇总到项目根目录下名为 NOTICE.md(或 ThirdPartyNotices.txt)的文件中。 文件头 以下文件头格式用于 .NET Foundation 项目。请在新文件中使用该格式,并酌情更新现有代码文件的文件头。注意,项目的一般版权声明在项目的 LICENSE 文件中给出,但任何第三方的版权声明都应保留。 ...

2026年3月10日

关于 EditorConfig 文件

EditorConfig 有助于为跨不同编辑器和 IDE 处理同一项目的多个开发人员保持一致的编码风格。 EditorConfig 项目由用于定义编码样式的文件格式和文本编辑器插件集合组成,这些插件使编辑器能够读取文件格式并遵循定义的样式。EditorConfig 文件易于读取,并且与版本控制系统配合得很好。 https://editorconfig.org Visual Studio 2019 及更高版本支持 EditorConfig 文件,可以在 Visual Studio 中使用 EditorConfig 文件来定义和维护代码样式设置。 https://github.com/dotnet/aspnetcore/blob/main/.editorconfig // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the <<LICENSE_TYPE>> license. // See the LICENSE file in the project root for more information. 在 Visual Studio 中使用 EditorConfig 文件添加文件头版权信息。 ...

2026年3月10日

如何优雅使用 Git 版本控制

Git 简介 Git 是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。 克隆存储库 将远程存储库克隆到本地,在本地进行修改,然后提交到远程存储库。 创建存储库 在本地创建存储库,然后将本地存储库推送到远程存储库。关于代码存储库的命名规范使用,使用 KebabCaseLower 命名法。 Naming policy Original Converted PascalCase HelloShop HelloShop CamelCase HelloShop helloShop SnakeCaseLower HelloShop hello_shop SnakeCaseUpper HelloShop HELLO_SHOP KebabCaseLower HelloShop hello-shop KebabCaseUpper HelloShop HELLO-SHOP 本地仓库设置 Git 设置包括全局设置和存储库设置,可设置多个远程存储库。 说明文件 在存储库中创建一个名为 README.md 的文件,用于存放存储库的说明文档,当然如果可能每个文件夹都应该有一个说明文档。 忽略文件 gitignore 文件的作用是指定不需要提交到代码存储库的文件,例如编译后的文件、日志文件等。 https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 常规操作 提取、拉取、提交、推送、同步、回滚、标签、冲突、暂存(行)、拉取。 分支管理 存储库分支用于管理存储库的版本,例如 master,develop,release,hotfix, feature 等。主要操作包括:创建分支,切换分支,合并分支,删除分支。 存储库管理 浏览存储库、管理存储库、使用多个存储库、解决合并冲突。

2026年3月10日

使用 Visual Studio 2022 中的 .HTTP 文件

注释 以 # 或 // 开头的行是注释,当 Visual Studio 发送 HTTP 请求时,将忽略这些行。 变量 以 @ 开头的行使用语法 @VariableName=Value 定义变量。 @hostname=localhost @port=44320 GET https://{{hostname}}:{{port}}/weatherforecast 多个请求 请求格式为: [<HTTP-verb>] <url> [<HTTP-version>] [<request-headers>] [<request-body>] GET https://localhost:7220/weatherforecast ### GET https://localhost:7220/weatherforecast?date=2023-05-11&location=98006 ### GET https://localhost:7220/weatherforecast HTTP/3 ### 请求标头 GET https://localhost:7220/weatherforecast Date: Wed, 27 Apr 2023 07:28:00 GMT ### GET https://localhost:7220/weatherforecast Cache-Control: max-age=604800 Age: 100 ### 请求正文 POST https://localhost:7220/weatherforecast Content-Type: application/json { "date": "2023-05-11", "location": "98006" } 使用模板创建 HTTP 文件 右键单击 ASP.NET Core 项目 添加>新建项 ASP.NET Core>常规 选择 HTTP 文件,然后选择添加 使用终结点资源管理器 视图>其他窗口>终结点资源管理

2026年3月10日