Why do I have broken references when importing a project template in VS 2019?

Jean Vallee 21 Reputation points
2021-04-01T13:29:01.583+00:00

I exported a project built in VS 2019 and created a new project based on that template.
When I opened the new project, ALL my references were broken.
The new project is using the exact same references stored in exactly the same folders.
Is there any way to stop this from happening or do I have to delete and add back each one?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,623 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 48,576 Reputation points
    2021-04-01T14:46:17.77+00:00

    It depends on what references are broken. By default a project template is for a single project and therefore any binary/project references won't work as you are dropping the generated project into a new solution that wouldn't have the other projects (or likely the correctly pathed binaries). However assembly references to framework assemblies and nuget packages should be fine as they will get properly restored.

    If you need to support project references then you'll need to create a multi-project template that can create multiple projects. This is non-standard and I'm not sure it is fully supported but it is documented somewhere how to do it.

    0 comments No comments

0 additional answers

Sort by: Most helpful