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

VS Extension: Method not found: 'System.String Umbraco.ModelsBuilder.Building.Compiler.CreateValidIdentifier(System.String)' #238

Open
hfloyd opened this issue Jul 20, 2020 · 2 comments

Comments

@hfloyd
Copy link

hfloyd commented Jul 20, 2020

I have been happily using the CustomTool version for years, but today decided to get with the program and install the newer VS Extension. When I ran "Build Models..." I get a dialog mentioning a failure and the output window says:

UmbracoModelsBuilder: Starting v8.1.1 7/20/2020 4:42:06 PM.
UmbracoModelsBuilder: UmbracoModelsBuilder failed to generate code: MissingMethodException: Method not found: 'System.String Umbraco.ModelsBuilder.Building.Compiler.CreateValidIdentifier(System.String)'.
UmbracoModelsBuilder:    at ZpqrtBnk.ModelsBuilder.Extension.Generator.GetNameSpace(String path)
   at ZpqrtBnk.ModelsBuilder.Extension.Generator.TryGenerate(ProjectItem sourceItem)
   at ZpqrtBnk.ModelsBuilder.Extension.Generator.Generate(AsyncPackage package, ProjectItem sourceItem)

This is my models folder structure:
image

The "ContentTypes" folder is not included in any project namespaces - it is just to separate "Umbraco Content Type-based" models from any other custom models needed.

My "_ModelBuilderConfig.cs" file includes an explicit namespace:

using Umbraco.ModelsBuilder;
[assembly: ModelsNamespace("MySite.Models")]

Perhaps this is related to this other issue: #228 ?

@EelmanE
Copy link

EelmanE commented Nov 4, 2020

not sure if this is still a problem, but i just ran into this today and my solution was to disabled (or remove) the old visual studio extension for modelsbuilder

@ProNotion
Copy link

@hfloyd I'm sure you are well past this already but I've hit the same issue in an old project and solved it so I will leave this comment here for anyone else that might have the problem including my future self. Coming from the previous version of the tool I had a .cs file I used to generate the classes previously. At some point I had removed the contents of the file. Adding the namespace in the file with no class made the error go away. That said, I removed the .cs file anyway afterwards to use this new method with the .mb file.

@EelmanE Your solution also helped me with another issue I had when running the tool 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants