从Jetbrains Rider发布Web项目

时间:2017-05-27 09:47:15

标签: rider

我试试Rider,到目前为止,非常喜欢它。

我在Visual Studio中使用的一个功能通常是右键单击Web项目并发布到我们的测试服务器。

我在Rider中找不到类似的选项,所以我所做的是创建一个运行配置,并使用以下设置:

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

当我想发布时,我从下拉列表中选择它并单击运行 这100%工作。

我的问题是,这是最好的方法吗,没有设置CI管道?我在IDE中缺少选项或设置吗?

编辑: UPDATE

2 个答案:

答案 0 :(得分:7)

截至2018年6月,Rider doesn't have UI for publishing

登录YouTrack后,您可以投票给feature request

作为一种变通办法,您可以像以前一样创建“ .NET可执行文件”配置,并在要发布项目时运行它。

更详细的说明如下:

  1. 运行>编辑配置
  2. 添加新配置> .NET可执行文件
  3. 名称 = 您的项目名称
  4. Exe路径 = MSBuild的路径(例如C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/amd64/MSBuild.exe
  5. 程序参数 = YourSolution.sln /t:"Your_Project" /p:PublishProfile=YourPublishProfile.pubxml /p:Configuration=Debug /p:DeployOnBuild=true /m
  6. 工作目录 = C:/path/to/solution/dir/

注意:

  • 项目发布配置文件通常位于Properties/PublishProfiles下的项目文件夹中。如果没有,则可以从下面报告的示例开始;
  • 您需要用下划线(_)替换项目名称中的点(。)。在上面的示例中,Your.Project作为Your_Project传递;
  • 如果尚未在发布配置文件中指定发布目录,则可以通过添加参数/p:PublishDir="C:/path/to/publish/dir/";
  • 来指定其他发布目录。
  • 如果您的计算机上未安装Visual Studio,则可以使用与Build Tools for Visual Studio 2017捆绑在一起的MSBuild。

发布个人资料的示例:

<?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>

答案 1 :(得分:0)

最新版本的Rider支持通过UI发布。如果您的计算机上未安装Visual Studio,请确保该Web项目已安装Build.Microsoft.VisualStudio.Web.targets nuget程序包。

相关问题