Building UWP project in GitHub Action with Visual Studio 2022 - c#

I'm trying to build a UWP project as part of a Github Actions Workflow.
In my YAML I am building and running a separate project so that I can debug my CICD pipeline locally. This separate project uses msbuild to build my main UWP project. Prior to recent changes (Github upgrading to Windows Server 2022 as the default runner + my team starting to use language features which require VS2022) this worked fine. Now I'm struggling to get things to build.
I've specified in my YAML to use Windows Server 2019 and Visual Studio 2022.
The msbuild command I run consists of:
var command = #"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe";
var x86Arguments = $#"ApplicationName /restore /p:Configuration=Release /p:Verbosity=minimal /p:Platform=x86 /p:AppxBundle=Never /p:UapAppxPackageBuildMode=StoreUpload";
The error I'm hitting is:
error MSB4019: The imported project
"C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.201\Microsoft\WindowsXaml\v17.0\Microsoft.Windows.UI.Xaml.CSharp.targets"
was not found. Confirm that the expression in the Import declaration
"C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.201\Microsoft\WindowsXaml\v17.0\Microsoft.Windows.UI.Xaml.CSharp.targets"
is correct, and that the file exists on disk.
I've tried to locate the targets file in the github runner and the only copy of it is from the VS2019 installation.
I've tried various attempts at targeting this file, which don't work.
Has anyone managed to build UWP apps with msbuild with VS2022 in a Github Workflow?

Related

Visual Studio Build Fails due to Error: MSB4025

Hi I am trying to run dotnet build <Sln file> to build the project but I am getting this error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
Build Failed
Folder Structure: C:\Users\USERNAME\PROJECTNAME\Folder0\File0.vdproj(1,1)
Dotnet Version: 6.0.301
I think that this information is useful.
vdproj is a MSI creation project for Visual Studio. Its been deprecated and most people have moved on to either WIX or NSIS or a professional grade installer creation tools such as Install Shield. If you do not require an installer for your product just exclude the vdproj project from the solution and continue with your life. For fun if you want to try to transition right away to wix, try this powershell script https://github.com/chrisoldwood/vdproj2wix
Visual Studio - vdproj is incompatible
MSI setup (.vdproj) This project can't be opened in Visual Studio 2013 because it doesn't support that project type. We recommend that you use InstallShield Limited Edition for Visual Studio (ISLE), a free deployment solution that directly supports most Windows platforms and application runtimes. You can also use ISLE to import data and settings from Visual Studio Installer projects.
Port, migrate, and upgrade Visual Studio projects

Brand new Xamarin.Forms project: The file "obj\Debug\android\bin\packaged_resources" does not exist

I just installed Visual Studio 2017 and I'm trying to work on a Xamarin.Forms project. I cloned the existing repo and could build and deploy the iOS app just fine, but when I try to build the Android app it throws the following error:
Severity Code Description Project File Line Suppression State
Error The file "obj\Debug\android\bin\packaged_resources" does not exist. [Solution Name].Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1794
Everything works great in Xamarin Studio on Mac.
I created a clean Xamarin.Forms project in VS 2017 to isolate any particular solution issues and am getting the exact same error.
How can I fix this?
This issue generally occurs when the correct Build Tools aren't correctly installed.
Open up the Android SDK Tools. Here is where it is if you are using Visual Studio.
Make sure you have the latest SDK Tools, Platform Toosl and Build Tools. Delete any preview or old build tools. I would use the Rev. 25 ones. Rev 24. had a few issues, I would make sure they are uninstalled.
Then make sure you have the correct SDK downloaded for whatever you are trying to compile for. E.g. 7.1, 7.0, 6.0 etc.
Then near the bottom I normally have at least
Android Support Library Google
USB Driver
After install, close all VS instances and start it up again.

.NET Core 1.0.1 VS 2015 Tooling Preview 2 without Visual Studio installed

I found many topics regarding this issue but it looks like it none of them can help me. I'm trying to install DotNetCore.1.0.1-VS2015Tools.Preview2.0.3.exe without Visual Studio installed - basically it's our build machine. When I run executable I get: "This product requires Visual Studio 2015 ..." . I've already tried to use SKIP_VSU_CHECK=1 and it didn't help.
Context:
We have TeamCity server build agents hosted on different machine and we don't want to install Visual Studio there. One of our project is *.xproj project and it cannot be built due to the following error: " error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
What I found so far is that I should install Vs2015Tools in order to build it. I have already installed .NET core SDK.

Visual Studio Online Build - Visual Studio SDK and Modellng SDK

I have included Visual Studio SDK and Modeling SDK in my project in order to build my T4 templates. It has been working fine until I wanted to set up the VSO Build, which gives me the following error:
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\TextTemplating\Microsoft.TextTemplating.targets"
was not found. Confirm that the path in the <Import> declaration is
correct, and that the file exists on disk.
However, I was unable to find any options or settings to import/include the mentioned SDKs into the build machine.
VSO Hosted build agent does not have Modeling SDK installed, refer to Hosted pool and Hosted build controller for details.
To build your solution, you need to deploy your own build agent and install the required SDK on it.

Elastic Bamboo CI Windows Server - MSBuild 12 not publishing

I have a custom image with Node.js, Microsoft Build Tools 2013, Windows SDK for Windows 8.1, .Net Framework 4.5.1 SDK, Microsoft Test Controller for Visual Studio 2013, Microsoft Agents for Visual Studio 2013 and Microsoft Web Deploy 3.5 installed.
Most things are working but I am struggling to get the project to package. I do not need the project to deploy directly to a web server; a zip will do fine.
On my dev machine I have a publish profile set that creates a folder with the content of my web project as I would expect. On the build server the project builds with no errors but no publishing happens. No error messages either.
I have tried a lot of potential solutions and these range from VS2010 to VS2013 but I have not had a success yet.
My publish profile and configuration is DevTest:
"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" MyWeb.csproj /p:Configuration=DevTest /p:VisualStudioVersion=12.0 /p:CreatePackageOnPublish=true /p:DeployOnBuild=true /p:Configuration=DevTest
Any help is appreciated!
I have managed to get this to work but I don't have a clean answer. I am guessing this is why there has not been any replies.
MSBuild is a complex beast mostly because it references many paths outside of the project. In my instance MSBuild was looking for ReportViewer.WebForms and other references in different installation locations. My project was referencing v10 but the reference location MSBuild was using looking for version 11.

Categories

Resources