You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
3
4
4
5
## Package
6
+
5
7
### 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.
7
10
8
11
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.
Modify `PACKAGE_NAME.csproj` to add package information, including version number, author, company, package description information, etc.
25
33
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).
27
35
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.
32
40
33
-
```xml
41
+
```xml
34
42
<PropertyGroup>
35
43
<Version>0.12.4</Version>
36
44
<Authors>Alice, Bob, Carol</Authors>
@@ -40,22 +48,27 @@ Modify `PACKAGE_NAME.csproj` to add package information, including version numbe
40
48
```
41
49
42
50
### Step 3: Build package with dotnet pack
51
+
43
52
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/`.
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.
4. When all the information is ready, select the Submit button.
65
78
66
79
### Command line
80
+
67
81
#### Step 1: Sign in & Create API keys
82
+
68
83
1.[Sign into your nuget.org](https://www.nuget.org/) account or create an account if you don't have one already.
69
84
70
85
2. Select your user name (on the upper right), then select **API Keys**.
71
86
72
87
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.)
73
88
74
89
4. Once the key is created, select **Copy** to retrieve the access key you need in the CLI:
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.
78
93
79
94
#### Step 2: Publish with dotnet nuget push
95
+
80
96
1. Change to the directory containing the `.nupkg` file (`bin/Debug/` or `bin/Release/`).
81
97
2. Execute the following command, specifying your package name and replacing the key value with your API key:
0 commit comments