Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish web project from JetBrains Rider

Tags:

I am giving Rider a try, and so far, quite like it.

One feature I use in Visual Studio quite often is right click on a web project and publish to our testing server.

I cannot find a similar option in Rider, so what I have done is, create a run configuration, with the following settings:

  • Exe path: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/amd64/msbuild.exe
  • Arguments: MySolution.sln /m /p:DeployOnBuild=True /p:PublishProfile=My-Project "/p:platform=Any CPU" /p:configuration=Release /p:VisualStudioVersion=15.0 /p:Password=****
  • Working Directory: C:\SolutionFolder

When I want to publish, I select it from the drop-down and click run.
This works 100%.

My question is, is this the best way to do it, sans setting up a CI pipeline? Am I missing an option or setting in the IDE?

Settings

like image 973
JonathanPeel Avatar asked May 27 '17 09:05

JonathanPeel


Video Answer


1 Answers

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> 
like image 139
Marco Lackovic Avatar answered Oct 16 '22 01:10

Marco Lackovic