Publish web project from JetBrains Rider

As of June 2018, Rider doesn't have UI for publishing.

There is a feature request which you can vote for, once logged in YouTrack.

As a workaround, one can create a '.NET Executable' configuration like you did, and run it when you want to publish your project.

More detailed instructions follows:

  1. Run > Edit Configuration
  2. Add new configuration > .NET Executable
  3. Name = your project name
  4. Exe path = path to your MSBuild (for example C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/amd64/MSBuild.exe)
  5. Program arguments = YourSolution.sln /t:"Your_Project" /p:PublishProfile=YourPublishProfile.pubxml /p:Configuration=Debug /p:DeployOnBuild=true /m
  6. Working directory = C:/path/to/solution/dir/

Notes:

  • the project publish profile is usually located in the project folder, under Properties/PublishProfiles. If you don't have one you can start with the example reported below;
  • you need to replace the dots (.) in the project name with underscores (_). In the example above Your.Project was passed as Your_Project;
  • you can specify a different publishing directory, if not already specified in the publish profile, by adding the argument /p:PublishDir="C:/path/to/publish/dir/";
  • if you don't have Visual Studio installed on your machine, you can use the MSBuild bundled with the Build Tools for Visual Studio 2017.

Example of publish profile:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>..\YourPublishDirectory</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <ExcludeFilesFromDeployment>bin\*.dll.config</ExcludeFilesFromDeployment>
  </PropertyGroup>
</Project>

Latest versions of Rider support publishing via UI. If you don't have Visual Studio installed on your machine, make sure the web project has Build.Microsoft.VisualStudio.Web.targets nuget package installed.

Tags:

Rider