microsoft / VSProjectSystem

Documentation for extending Visual Studio with new types of projects.
Other
313 stars 87 forks source link

Throw error when build ProjectType in VS 2017.15.8.2 #283

Open Ghost7137 opened 6 years ago

Ghost7137 commented 6 years ago

Hi team,

I use this Visual Studio Project System Extensibility which version is 15.8.243.29717. After I create Project Type when I build it VS throw error as follow:

Severity Code Description Project File Line Suppression State Error CS1061 'ProjectProperties' does not contain a definition for 'ConfiguredProject' and no accessible extension method 'ConfiguredProject' accepting a first argument of type 'ProjectProperties' could be found (are you missing a using directive or an assembly reference?) PuzzleProjectType.ProjectType C:\Users\LeeLi.GRAPECITY\Source\Repos\PuzzleProjectType\PuzzleProjectType\PuzzleProjectType.ProjectType\obj\Debug\debugger_general.cs 316 N/A

My VS 2017 it Community version, and the Version for VS is 15.8.2. I also send your images for this error hope can help.

2018-09-03_160047 2018-09-03_160022

Best wishes, Lee

CartBlanche commented 3 years ago

@Ghost7137 Did you ever workout what caused it? And how to fix it?

adrianvmsft commented 9 months ago

This issue may happen in projects using PackageReference (rather than packages.config) because the nuget package doesn't add the ProjectProperties.cs containing the class constructors to the project. Workaround is to manually add the following file to the project and update it to match your project (e.g. namespace): https://github.com/microsoft/VSProjectSystem/blob/master/samples/WindowsScript/WindowsScript/WindowsScript.ProjectType/ProjectProperties.cs We are planning to add this file to the ProjectType template so that it gets created when creating a new ProjectType project.