Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ALM Accelerator - BUG]: Restoring NuGet packages fails for Unit Test projects that use CentralPackageVersions #5623

Closed
joshcampbell191 opened this issue May 24, 2023 · 5 comments · Fixed by microsoft/coe-alm-accelerator-templates#305
Assignees
Labels
alm-accelerator ALM Accelerator Components and Apps bug Something isn't working

Comments

@joshcampbell191
Copy link

Describe the issue

We're currently using CentralPackageVersions to manage the versions for our dependencies. This means that all our NuGet packages are managed via PackageReference items in the Unit Test csproj file. When the pipeline attempts to restore the NuGet packages for the Unit Test project, it fails and errors out.

This appears to stem from the following: https://github.com/microsoft/coe-alm-accelerator-templates/blob/main/Pipelines/Templates/build-run-unit-test-projects.yml#L47

Since our project doesn't contain any packages.config, the script fails to restore any packages and returns an error causing the step to fail.

Expected Behavior

Before restoring packages from a packages.config file, it should check that the file exists.

What component are you experiencing the issue with?

ALM Accelerator Pipelines

What solution version are you using?

Accelerator Version: 1.0.20230517.1

Steps To Reproduce

  1. Create a unit test project.
  2. Setup CentralPackageVersions to maintain the version of NuGet packages.
  3. Add a NuGet package to the project via PackageReference in the csproj file.
  4. Trigger the build-Solution pipeline.

Anything else?

image

@joshcampbell191 joshcampbell191 added alm-accelerator ALM Accelerator Components and Apps bug Something isn't working labels May 24, 2023
@mikefactorial
Copy link
Collaborator

Thanks @joshcampbell191 for pointing this out. Were you able to find a workaround for this? Happy to take a look if you want to submit a Pull Request based on your project setup.

@joshcampbell191
Copy link
Author

I can submit a PR that will check for the presence of the packages.config before attempting to restore the NuGet packages if that works for you.

@mikefactorial
Copy link
Collaborator

Thanks @joshcampbell191. That would be great. Since we don't have context for how your specific project is setup / configured it's difficult to assume what change is required here and would likely be easier for you to make the change for us to review.

@joshcampbell191
Copy link
Author

@mikefactorial I opened a PR with my proposed solution. Let me know if you require any additional changes.

@CoEStarterKitBot
Copy link
Collaborator

@joshcampbell191 This has been fixed in the latest release. Please install the latest version of the toolkit following the instructions for installing updates. Note that if you do not remove the unmanaged layers as described there you will not receive updates from us.

CoEStarterKitBot pushed a commit that referenced this issue Jul 9, 2023
* Fix for #5623

* Removing connection param clearing

* Removing connectionparam clearing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alm-accelerator ALM Accelerator Components and Apps bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants