C# WPF program works fine but pipeline fails
Asked by Varun Chandra:

I have a WPF project that I worked on and its working great. My team has been using this for test automation in our lab. I recently decided to improve the way we handle our software's and decided to configure pipelines and develop unit tests. I managed to write a couple of unit tests and they currently pass.

I read a couple of blogs and tried to configure a pipeline for my repo on bitbucket. For some reason I can't get it to pass. It fails all the time. I fixed the initial errors that I got and they don't appear any more. But the latest error doesn't make any sense. Here is the output:  

+ dotnet build  
Microsoft (R) Build Engine version 16.7.3+2f374e28e for .NET  
Copyright (C) Microsoft Corporation. All rights reserved.  
Determining projects to restore...  
/usr/share/dotnet/sdk/3.1.426/NuGet.targets(128,5): error : Invalid restore input. Invalid target framework 'unsupported'. Input files: /opt/atlassian/pipelines/agent/build/Common/CommonLibraries/CommonLibraries.csproj. [/opt/atlassian/pipelines/agent/build/InverterAutomation.sln]  
Build FAILED.  
/usr/share/dotnet/sdk/3.1.426/NuGet.targets(128,5): error : Invalid restore input. Invalid target framework 'unsupported'. Input files: /opt/atlassian/pipelines/agent/build/Common/CommonLibraries/CommonLibraries.csproj. [/opt/atlassian/pipelines/agent/build/InverterAutomation.sln]  
0 Warning(s)  
1 Error(s)  
Time Elapsed 00:00:00.82  
![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/240391iDE2EAA29FB497100/image-size/large?v=v2&px=999 "image.png")  
Main Project (has a output file). This has the WPF component. ![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/240393iCB749033AB096FD8/image-size/large?v=v2&px=999 "image.png")Library project. Has no output component. ![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/240392i143FF645C4F7846B/image-size/large?v=v2&px=999 "image.png")


Answers:
author: Theodora Boudale
body: Hi [@Varun Chandra](/t5/user/viewprofilepage/user-id/4743725)!

Pipelines builds are executed in Docker containers based on the Docker image you define in the bitbucket-pipelines.yml file of your repo (your yml file has as image the Docker Hub image mcr.microsoft.com/dotnet/core/sdk:3.1).

Pipelines that run in our own infrastructure can build .NET Core applications, as .NET Core is cross-platform.

I read the documentation for WPF here:

* <https://learn.microsoft.com/en-us/dotnet/desktop/wpf/overview/?view=netdesktop-7.0>

I see there that WPF only runs on Windows, so it looks like it is not possible to build this application in Pipelines, as Pipelines currently runs on a Kubernetes cluster of Linux Docker hosts.

We offer Windows Runners that allow you to run builds in Pipelines on your own Windows infrastructure, and you don't get charged for the build minutes used by your self-hosted Windows runner:

* <https://support.atlassian.com/bitbucket-cloud/docs/set-up-runners-for-windows/>
* <https://support.atlassian.com/bitbucket-cloud/docs/configure-your-runner-in-bitbucket-pipelines-yml/>

If you have a Windows machine that you can use to run your builds, you can look into configuring a Windows Runner for these builds instead. You will be able to view the build logs for these builds as well on the Pipelines page of the repo on our website.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud