代码之家  ›  专栏  ›  技术社区  ›  Bercovici Adrian

发布.NET Core时未创建发布版本的文件夹

  •  0
  • Bercovici Adrian  · 技术社区  · 6 年前

    publish 并将其放入另一个应用程序的文件夹中。

    问题是当我使用 dotnet publish 这个 出版 文件夹仅为 Debug 建造。
    即使我的项目还在进行 Release dotnet 命令为 调试 我做错什么了?

    releasepath="D:\Work\redius\core\redius\bin\Release\netcoreapp2.1\publish" 
    destpath="D:\dotpeek"
    rediuspath="D:\Work\redius"
    curDir="$(pwd)\out.txt"
    
    if  [ ! -f curDir ]; 
    then  
    touch  $curDir
    fi
    
    echo $releasepath
    rm -rf  $destpath
    mkdir $destpath
    (cd $rediuspath &&  dotnet publish | $curDir && echo "done publishing")
    echo "Copying from : ${releasepath} to ${destpath}"
    cp -rf  releasepath destpath
    cd
    

    我需要为脚本的第一行提供文件夹。我已尝试使用 出版 vstudio 但它创造了一个 nupkg 文件。

    2 回复  |  直到 6 年前
        1
  •  1
  •   prisar    6 年前

    你必须用 dotnet build -c Release

        2
  •  3
  •   renklus    6 年前

    dotnet publish 首先构建项目,然后发布它。默认情况下,生成配置 Debug 已使用。

    如果要使用生成配置生成项目 Release 您必须指定 -c 旗帜。

    dotnet publish -c Release
    

    https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore21

    dotnet build -c Release
    dotnet publish --no-build