Template Not Usable in VS2022 after Update

William 41 Reputation points
2024-01-18T13:03:59.94+00:00

After VS 2022 updated, using an exported template will not build without errors. One error is " (are you missing an assembly reference?)", yet in the references it is there. This problem happened in the past with VS2022 before the update, but could be fix by uninstalling NuGet packages and reinstalling them. I have uninstalled VS2022 and reinstall it, still the same problem. I have deleted all template zip files and reexported them. Still the same problem.

Developer technologies | Windows Forms
Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Michael Taylor 60,326 Reputation points
    2024-01-18T15:33:58.12+00:00

    You didn't clarify whether you're talking about an item or project template but I'm assuming a project template here. In that case it is literally just a zip file with the project file and source files inside it. You can unzip the contents into a new directory, fix up any substitution variables used (like the project name) and build and it is no different than when you do this manually.

    Without seeing the project file contents we can only make some guesses as to what is going on.

    • The project hasn't restored all the packages yet so you're seeing a temporal issue. If you build your code that problem would go away. If it doesn't then it isn't a restore issue.
    • You are relying on a Nuget package that is no longer available (or was a pre-release).
    • You changed the framework version from what the project originally targeted (either manually or via the project file properties).

    You should be able to create a brand new project of the same type, replace the generated project file with whatever is in your project template file, copy over the source files and basically be in the same state as when the project template is used directly.

    If you can post the project file contents and the actual error(s) you're seeing along with any other relevant information we might be able to provide more guidance.

    0 comments No comments

  2. Tianyu Sun-MSFT 34,441 Reputation points Microsoft External Staff
    2024-01-19T06:51:13.0266667+00:00

    Hello @William,

    Welcome to Microsoft Q&A forum.

    In Tools => Options => NuGet Package Manager => General => Package Restore, are "Allow NuGet to download missing packages" and "Automatically check for missing packages during build in Visual Studio" options checked?

    I guess the NuGet packages were not automatically installed into your new project when you used the exported template to create a new project.

    Are you using a .NET Framework(instead of .NET/.NET Core) based project template?

    If so, does a folder called "packages" exist in your solution folder? Do those NuGet packages really exist in this "packages" folder?

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. William 41 Reputation points
    2024-01-24T01:21:37.1466667+00:00

    I'm using the following VS2022

    Microsoft Visual Studio Community 2022
    Version 17.8.5
    VisualStudio.17.Release/17.8.5+34511.84
    Microsoft .NET Framework
    Version 4.8.09032
    
    Installed Version: Community
    
    ASP.NET and Web Tools   17.8.358.6298
    ASP.NET and Web Tools
    
    Azure App Service Tools v3.0.0   17.8.358.6298
    Azure App Service Tools v3.0.0
    
    C# Tools   4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    
    Extensibility Message Bus   1.4.39 (main@e8108eb)
    Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
    
    Microsoft JVM Debugger   1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
    
    Mono Debugging for Visual Studio   17.8.17 (957fbed)
    Support for debugging Mono processes with Visual Studio.
    
    NuGet Package Manager   6.8.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
    
    Razor (ASP.NET Core)   17.8.3.2405201+d135dd8d2ec1c2fbdee220e8656b308694e17a4b
    Provides languages services for ASP.NET Core Razor.
    
    TypeScript Tools   17.0.20920.2001
    TypeScript Tools for Microsoft Visual Studio
    
    Visual Basic Tools   4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    
    Visual F# Tools   17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50
    Microsoft Visual F# Tools
    
    Visual Studio IntelliCode   2.2
    AI-assisted development for Visual Studio.
    
    VisualStudio.DeviceLog   1.0
    Information about my package
    
    VisualStudio.Mac   1.0
    Mac Extension for Visual Studio
    
    VSPackage Extension   1.0
    VSPackage Visual Studio Extension Detailed Info
    
    Xamarin   17.8.0.157 (d17-8@8e82278)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
    
    Xamarin Designer   17.8.3.6 (remotes/origin/d17-8@eccf46a291)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
    
    Xamarin.Android SDK   13.2.2.0 (d17-5/45b0e14)
    Xamarin.Android Reference Assemblies and MSBuild support.
        Mono: d9a6e87
        Java.Interop: xamarin/java.interop/d17-5@149d70fe
        SQLite: xamarin/sqlite/3.40.1@68c69d8
        Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d
    
    I would attached the template file but this form will not accept it.
    There is no folder called "packages" in my solution folder, the Nuget-Solution tab has the following, 
    
    On the original project solution which build and runs does not have a folder called "packages".
    
    

  4. William 41 Reputation points
    2024-01-24T01:29:48.5866667+00:00

    Not sure what happened, but when I posted my response it deleted the image of what was in Nuget- Solution. Also how do I get notified someone responded to my question? User's image

    0 comments No comments

  5. William 41 Reputation points
    2024-01-25T12:37:52.38+00:00

    I have uninstalled VS2022, reinstalled VS2022 and have same plus new problem. Repaired VS2022 and have the same plus new problems. Started a new project to test VS2022 Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.8.5 .NET Framework 4.7.2 project Added a timer1 to the Form1.cs(Design) and a textbox. In the timer it increments a Count and displays it in the textbox which builds and runs. In NuGet-Solution, Installed ScottPlot.WinForms. When I dragged the 'FormsPlot' from ScottPlot.WinForms in toolbox, I get the following error, Error Image 1-25-24

    It looks like it is trying get something on my "" drive that does not exist. Any suggestions how to fix?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.