Search code examples
seleniumunit-testingazure-devopsazure-pipelinesasp.net-core-3.1

Selenium Test .net core 3.1 on Release Pipeline has framework Mismatch


I have a simple selenium test on .net core 3.1 with selenium.webdriver. Selenium test

I build it on the build pipelines with yaml that does Restore > publish > publish artifact. The Dlls look fine. I put this into a release pipeline and I keep getting: Error

My pipeline tasks are a Pipeline Platform installer running the Latest and a VSTest task that runs the "Installed by tooler". My Agent is Azure pipelines with windows-2019. Not sure what I am missing here. I cant run this simple test. Thanks


Solution

  • If you using VStest task to run dotnet-core-3.1 tests. You need to specify the framework option to .NETCoreApp,Version=v3.1 in the Other console options field: See below:

    - task: VSTest@2
      displayName: 'VsTest - testAssemblies'
      inputs:
        testAssemblyVer2: |
         **\*Test*.dll
         !**\*TestAdapter.dll
         !**\obj\**
        codeCoverageEnabled: true
        otherConsoleOptions: '/framework:".NETCoreApp,Version=v3.1"'
    

    enter image description here

    You can also use dotnet test task in the release pipeline to run the tests on .net core 3.1.