An online markdown blog and knowledge repository.
Various notes regarding application publishing in the .NET Ecosystem.
This note was started on 16-Jan-2024:
Publish Self-Contained means:
Drawbacks:
The simplest deployment type:
Note: NuGet Package dependencies could still be platform-specific.
# cross-platform and framework-dependent
dotnet publish
# platform-specific and framework-dependent
dotnet publish -r win-x64
# platform-specific and framework-dependent for linux
dotnet publish -r linux-x64
Use the dotnet
publish
command with argument --self-contained
:
dotnet publish --self-contained
Specify the target:
15.10
.-r <RID>
parameter.# Windows 64-bit
dotnet publish -r winx64 --self-contained
# Windows 32-bit
dotnet publish -r win-x86 --self-contained
# Windows arm64
dotnet publish -r win-arm64 --self-contained
RIDs need to be specific:
These will improve startup time but will produce an even larger installer file, and do not contain the JIT.
dotnet publish -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true
Just a quick list of notes:
Publish apps using Native AOT via the command line.
There are AOT-Compatibility Analyzers that can indicate whether a library is Native AOT ready.
VS Code has a special tool called VSCE for Packaging Pre-Release and Release packages in the VSIX format for use in the Visual Studio Marketplace.
Developing in JavaScript is very similar to any other JS or Node-based development workflow: Use NPM
or Yarn
to add dependecies or dev dependencies, and update package.json
to configure scripts and basic features of the project.
VSCE can be installed using npm: npm i @vscode/vsce
.
VSCE can utilize package.json to get product details such as display name
, description
, icon
, repository
, version
, publisher
, pricing
, categories
, and much more.
VSCE leverages .vscodeignore
to filter-out files that are not necessary in the package itself. It is good practice to reduce the file size as much as possible by eliminating all but the absolutely necessary files.
Pre-release and push to the Visual Studio Marketplace: vsce publish -p { vsce_pat } --pre-release
It is important to note that README.md is used as the Details page view within the Extensions view in VS Code. Excluding files using .vscodeignore
does not remove the files from the appearance in the Marketplace or Extensions viewer.
In order to push a Package to the VS Marketplace, the following must be true:
package.json
version
element must be above any existing Published version in the VS Marketplace.publisher
element in package.json
must match an existing VS Marketplace Publisher.Private Access Tocken
(PAT) must be associated with the configured VS Marketplace Publisher.Note that VSCE has some interesting default behavior:
vsce package
will use the existing package.json
version
element during its packaging process.vsce publish
is very similar to vsce package
except it automatically tries to increment the package.json
version
element and execute npm i
, then tries to push the package to the VS Marketplace automatically. If a PAT has not been included, the command could prompt for one.Automatic publication of Release or Pre-Release versions is possible using VSCE.
It is also possible to manually package the Extension with VSCE, login to the VS Marketplace mangaement portal, and then upload the VSIX file in just a few clicks.
Either way, VS Marketplace will take a few minutes to process the file.
The next time a user opens VSCode, they will see a notification for each new Release (and might see notifications for Pre-Releases, if they've opted in).
.vscode/**
.vscode-test/**
test/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/jsconfig.json
**/*.map
**/.eslintrc.json
**/*.ts
**/tsconfig.json
While building the Create Table of Contents VS Code Extension, a workflow developed based on:
Tools:
.github/workflows
for the automated unittesting and packaging YAML scripts.Branching:
Workflow:
Staging
branch.Staging
. Workflows run unittests and pass/fail PR approval.Staging
branch and a new PR is created to merge with pub-pre-release
branch.pub-pre-release
branch commits, and manually execute VSCE to produce a Release Publish package that can be manually uploaded to the VS Extension Marketplace Publisher Portal.main
.Releases
page could be updated to allow downloading the latest Release VSIX file for manual importation and use.Note: Step 8 should eventually get updated to a proper branch workflow with an automated Release operation.
Note2: Step 10 could be automated to push the VSIX
artifact to the GitHub Releases
page.
package.json
, CHANGELOG.md
, .gitignore
, .vscodeignore
, and README.md
.npm i
. All installations should complete with out Security Issues or other errors.npm test
. All Linting and Tests should pass before continuing.vsce package --no-update-package-json {major.minor.patch}
and the output file will be named {package_json_name}-{major.minor.patch}.vsix
.Note: To auto-increment the version number, just run vsce package
and package.json
will get updated with an incremented version
property.
Note2: VSCE includes options login <publisher>
and publish [options] [version]
to allow publishing directly to the VS Extension Marketplace.
Note3: publish
and package
commands are very similar so it is possible to publish a version without adding a version control change.
DevOps, Testing, and deployment documentation on MSLearn: Publish Self-Contained.
Runtime Identifiers in the MS Learn .NET RID Catalog.
Overview of .NET Native AOT.
Return Conted Index
Return to root README