2

I have created a shared .NetStandard2.0 library for my projects. Sample method looks like below:

namespace SharedLibrary
{
    public sealed class MySecrets
    {
        public string GetSecrets()
        {
            // Do some activity
            string mySecreteString = "XXXX";
            return mySecreteString;
        }
    }
}

I have also created Yaml Pipeline that push the Nuget of the library in feeds as below.

trigger:
- main

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  major: '3'
  minor: '0'
  revision: $[counter(variables['minor'], 1)] # This will get reset every time minor gets bumped.
  nugetVersion: '$(major).$(minor).$(revision)'

steps:
- task: UseDotNet@2
  displayName: 'Use .NetCore SDK'
  inputs:
    packageType: sdk
    version: 3.x
- task: DotNetCoreCLI@2
  displayName: Restore Task
  inputs:
    command: restore
    projects: '**\*csproj'

- task: DotNetCoreCLI@2
  displayName: Build Taks
  inputs:
    command: build
    projects: '**/*csproj'
    arguments: '--configuration Release'

- task: DotNetCoreCLI@2
  inputs:
    command: 'pack'
    packagesToPack: 'SharedLibrary/SharedLibrary.csproj' 
    versioningScheme: 'byEnvVar'
    versionEnvVar:  'nugetVersion'
- task: DotNetCoreCLI@2
  inputs:
    command: 'push'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
    nuGetFeedType: 'internal'
    publishVstsFeed: 'XXXXX-8335-4cbc-9c43-2db9ad7e4000'

I have learned the .dll can be decompiled. So I have applied followed this Obfuscar reffernce to my project and obfuscar.xml and post build event "$(Obfuscar)" obfuscar.xml to my solution. but the build is failing after adding obfuscar.

enter image description here

Not sure how to make build work after obfuscation in DevOps Also, I happy to implement other way that we can generate obfuscator nuget in Azure Devops pipeline.

Learner
  • 51
  • 5
  • Don't post screenshots of error messages. Post the actual error text. Screenshots prevent the blind and visually impaired from being able to contribute, as well as inhibit the ability to index and search the text. – Daniel Mann Aug 25 '22 at 16:35
  • @DanielMann Sure, I will follow the same next time. – Learner Aug 26 '22 at 04:50

0 Answers0