Skip to content

Commit 148e2a9

Browse files
committed
test
1 parent 0683b4d commit 148e2a9

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

PUBLISH.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,44 @@
11
# Publish your own nuget package
2+
23
In this doc, we will introduce how to package and publish your own nuget package. Note that this will include the packaging and release of the two packages.
34

45
## Package
6+
57
### Step 1: Rename
6-
Rename the following files/directories, where PACKAGE_NAME is the package name you expect.
8+
9+
Rename the following files/directories, where PACKAGE_NAME is the package name you expect.
710

811
Note that this name should be unique, otherwise it will be rejected. You can search at [nuget.org](https://www.nuget.org/) to confirm whether the name is unique.
9-
- `./src/Apache.IoTDB` => `./src/PACKAGE_NAME`
10-
- `./src/Apache.IoTDB/Apache.IoTDB.csproj` => `./src/PACKAGE_NAME/PACKAGE_NAME.csproj`
11-
- `./src/Apache.IoTDB.Rpc.Generated` => `./src/PACKAGE_NAME.Rpc.Generated`
12-
- `./src/Apache.IoTDB.Rpc.Generated/Apache.IoTDB.Rpc.Generated.csproj` => `./src/PACKAGE_NAME.Rpc.Generated/PACKAGE_NAME.Rpc.Generated.csproj`
12+
13+
- `./src/Apache.IoTDB` => `./src/PACKAGE_NAME`
14+
- `./src/Apache.IoTDB/Apache.IoTDB.csproj` => `./src/PACKAGE_NAME/PACKAGE_NAME.csproj`
15+
- `./src/Apache.IoTDB.Rpc.Generated` => `./src/PACKAGE_NAME.Rpc.Generated`
16+
- `./src/Apache.IoTDB.Rpc.Generated/Apache.IoTDB.Rpc.Generated.csproj` => `./src/PACKAGE_NAME.Rpc.Generated/PACKAGE_NAME.Rpc.Generated.csproj`
1317

1418
Besides, you also need to modify the configuration in `./src/Apache.IoTDB/Apache.IoTDB.csproj` to ensure that the project references are correct.
15-
``` xml
19+
20+
```xml
1621
<ProjectReference Include="..\Apache.IoTDB.Rpc.Generated\Apache.IoTDB.Rpc.Generated.csproj" />
1722
```
23+
1824
to
19-
``` xml
25+
26+
```xml
2027
<ProjectReference Include="..\PACKAGE_NAME.Rpc.Generated\PACKAGE_NAME.Rpc.Generated.csproj" />
2128
```
2229

2330
### Step 2: Add package information
31+
2432
Modify `PACKAGE_NAME.csproj` to add package information, including version number, author, company, package description information, etc.
2533

26-
The commonly used ones are as follows, you can find a complete list in [NuGet pack and restore as MSBuild targets](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target).
34+
The commonly used ones are as follows, you can find a complete list in [NuGet pack and restore as MSBuild targets](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target).
2735

28-
- `Version`, a specific version number in the form Major.Minor.Patch\[-Suffix\] where -Suffix identifies [pre-release versions](https://docs.microsoft.com/en-us/nuget/create-packages/prerelease-packages). If not specified, the default value is 1.0.0.
29-
- `Authors`, author and owner information. If not specified, the default value is AssemblyName.
30-
- `Company`, your company name. If not specified, the default value is AssemblyName.
31-
- `PackageDescription`, A long description of the package for UI display.
36+
- `Version`, a specific version number in the form Major.Minor.Patch\[-Suffix\] where -Suffix identifies [pre-release versions](https://docs.microsoft.com/en-us/nuget/create-packages/prerelease-packages). If not specified, the default value is 1.0.0.
37+
- `Authors`, author and owner information. If not specified, the default value is AssemblyName.
38+
- `Company`, your company name. If not specified, the default value is AssemblyName.
39+
- `PackageDescription`, A long description of the package for UI display.
3240

33-
``` xml
41+
```xml
3442
<PropertyGroup>
3543
<Version>0.12.4</Version>
3644
<Authors>Alice, Bob, Carol</Authors>
@@ -40,22 +48,27 @@ Modify `PACKAGE_NAME.csproj` to add package information, including version numbe
4048
```
4149

4250
### Step 3: Build package with dotnet pack
51+
4352
Execute the following commands in the same directory of `PACKAGE_NAME.csproj` and `PACKAGE_NAME.Rpc.Generated.csproj` to pack. You can find the generated package file `PACKAGE_NAME.VERSION.nupkg` in `bin/`.
4453

4554
#### Debug
46-
``` bash
47-
dotnet pack PACKAGE_NAME.csproj --configuration debug
55+
56+
```bash
57+
dotnet pack PACKAGE_NAME.csproj --configuration debug
4858
```
4959

5060
#### Release
51-
``` bash
52-
dotnet pack PACKAGE_NAME.csproj --configuration release
61+
62+
```bash
63+
dotnet pack PACKAGE_NAME.csproj --configuration release
5364
```
5465

5566
## Publish
67+
5668
### Web portal: use the Upload Package tab on nuget.org
69+
5770
1. Select Upload on the top menu of nuget.org and browse to the package location.
58-
![](https://docs.microsoft.com/en-us/nuget/nuget-org/media/publish_uploadyourpackage.png)
71+
![](https://docs.microsoft.com/en-us/nuget/nuget-org/media/publish_uploadyourpackage.png)
5972

6073
2. nuget.org tells you if the package name is available. If it isn't, change the package identifier in your project, rebuild, and try the upload again.
6174

@@ -64,26 +77,31 @@ dotnet pack PACKAGE_NAME.csproj --configuration release
6477
4. When all the information is ready, select the Submit button.
6578

6679
### Command line
80+
6781
#### Step 1: Sign in & Create API keys
82+
6883
1. [Sign into your nuget.org](https://www.nuget.org/) account or create an account if you don't have one already.
6984

7085
2. Select your user name (on the upper right), then select **API Keys**.
7186

7287
3. Select **Create**, provide a name for your key, select **Select Scopes > Push**. Enter **\*** for **Glob pattern**, then select **Create**. (See below for more about scopes.)
7388

7489
4. Once the key is created, select **Copy** to retrieve the access key you need in the CLI:
75-
![](https://docs.microsoft.com/en-us/nuget/quickstart/media/qs_create-02-apikey.png)
90+
![](https://docs.microsoft.com/en-us/nuget/quickstart/media/qs_create-02-apikey.png)
7691

7792
5. **Important**: Save your key in a secure location because you cannot copy the key again later on. If you return to the API key page, you need to regenerate the key to copy it. You can also remove the API key if you no longer want to push packages via the CLI.
7893

7994
#### Step 2: Publish with dotnet nuget push
95+
8096
1. Change to the directory containing the `.nupkg` file (`bin/Debug/` or `bin/Release/`).
8197
2. Execute the following command, specifying your package name and replacing the key value with your API key:
82-
``` .NET CLI
98+
99+
```.NET CLI
83100
dotnet nuget push PACKAGE_NAME.VERSION.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json
84101
```
85102

86103
## References
104+
87105
[MS Docs: Create a NuGet package](https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package-dotnet-cli)
88106

89107
[MS Docs: Publishing packages](https://docs.microsoft.com/en-us/nuget/nuget-org/publish-a-package)

0 commit comments

Comments
 (0)