【问题标题】:Why are bin and obj folders not getting created when I am building a csproj file on azure devops using pipeline?当我使用管道在 azure devops 上构建 csproj 文件时,为什么没有创建 bin 和 obj 文件夹?
【发布时间】:2020-01-11 22:46:58
【问题描述】:

我正在使用管道在 Azure 开发操作上构建 C# 点网项目。构建成功运行,但构建后,我需要在工件中查看项目的 bin 和 obj 文件夹,我需要从中获取已编译的 dll,但未创建 bin 和 obj 文件夹。下面是管道 yaml 代码中的构建命令:

- task: VSBuild@1
  inputs:
   solution: 'C#\Ignify.eComIntegration\EventLogger\EventLogger.csproj'
   msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package 
   /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true 
   /p:PackageLocation="$(build.artifactStagingDirectory)"'
   platform: '$(buildPlatform)'
   configuration: '$(buildConfiguration)' 

另外,下面给出的是 csproj 文件中的部分代码:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>d:\a\1\s\C#\Ignify.eComIntegration\EventLogger\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

请建议如何创建文件夹。

【问题讨论】:

    标签: c# .net azure azure-devops azure-pipelines


    【解决方案1】:

    您的构建任务只需创建一个要部署在$(build.artifactStagingDirectory) 文件夹中的包。您需要添加额外的构建步骤来复制额外的文件:Copy Files task。像这样的:

    - task: CopyFiles@2 displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)' inputs: Contents: | **\bin\** **\obj\** TargetFolder: '$(Build.ArtifactStagingDirectory)'

    【讨论】:

    • 即使在工件中没有创建bin和obj文件夹也能正常工作吗?
    • @TVicky,以下是对我有用的任务序列:构建解决方案、发布符号路径、复制文件任务、发布工件。
    • @TVicky 我已经更新了答案并测试了这个任务。使用**\bin\****\obj\** 作为内容模板。
    • @ShamraiAleksander,bin 和 obj 文件夹是为其他解决方案创建的,但不是我想要的。
    猜你喜欢
    • 1970-01-01
    • 2019-04-14
    • 2020-05-26
    • 1970-01-01
    • 2011-07-15
    • 2021-11-05
    • 2019-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多