hybridview / ConfigurationSectionDesigner

Moved from CodePlex, which is closing.,
MIT License
65 stars 19 forks source link

VS2015: Compiling transformation error #5

Closed neutmute closed 6 years ago

neutmute commented 7 years ago

Thanks for breathing some life back into this awesome tool. I've used it successfully before on other projects but using v2.0.3-alpha.2 gives these errors. Any ideas?

Severity    Code    Description Project File    Line    Suppression State
Error       Compiling transformation: '<invalid-global-code>' does not contain a definition for 'Store' and no extension method 'Store' accepting a first argument of type '<invalid-global-code>' could be found (are you missing a using directive or an assembly reference?) MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  35  
Error       Compiling transformation: '<invalid-global-code>' does not contain a definition for 'AddDomainModel' and no extension method 'AddDomainModel' accepting a first argument of type '<invalid-global-code>' could be found (are you missing a using directive or an assembly reference?)   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  25  
Error       Compiling transformation: '<invalid-global-code>' does not contain a definition for 'Errors' and no extension method 'Errors' accepting a first argument of type '<invalid-global-code>' could be found (are you missing a using directive or an assembly reference?)   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  29  
Error       Compiling transformation: '<invalid-global-code>.configurationsectionmodelValue' is inaccessible due to its protection level    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  8   
Error       Compiling transformation: '<invalid-global-code>.ConvertConfigurationSectionModelRelativePathToTemplateRelativePath(string)' is a new virtual member in sealed class '<invalid-global-code>'    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  12  
Error       Compiling transformation: '<invalid-global-code>.Host.get' is a new virtual member in sealed class '<invalid-global-code>'  MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  646 
Error       Compiling transformation: '<invalid-global-code>.Host.set' is a new virtual member in sealed class '<invalid-global-code>'  MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  650 
Error       Compiling transformation: '<invalid-global-code>.hostValue' is inaccessible due to its protection level MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  648 
Error       Compiling transformation: '<invalid-global-code>.Initialize()': no suitable method found to override    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  23  
Error       Compiling transformation: '<invalid-global-code>.this[GenerationEnvironment.ToString]': property or indexer must have at least one accessor MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: 'GeneratedTextTransformation' does not contain a definition for 'ConfigurationSectionModel' and no extension method 'ConfigurationSectionModel' accepting a first argument of type 'GeneratedTextTransformation' could be found (are you missing a using directive or an assembly reference?) MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  17  
Error       Compiling transformation: 'GeneratedTextTransformation.TransformText()': not all code paths return a value  MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  7   
Error       Compiling transformation: 'ModelingTextTransformation.ConvertModelRelativePathToTemplateRelativePath(string, string, string)' is inaccessible due to its protection level   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  16  
Error       Compiling transformation: 'object' does not contain a definition for 'Initialize'   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  28  
Error       Compiling transformation: ; expected    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  634 
Error       Compiling transformation: A get or set accessor expected    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: A namespace cannot directly contain members such as fields or methods MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  640 
Error       Compiling transformation: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  635 
Error       Compiling transformation: Expected catch or finally MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  248 
Error       Compiling transformation: Identifier expected   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: Invalid token '(' in class, struct, or interface member declaration   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  635 
Error       Compiling transformation: Invalid token ')' in class, struct, or interface member declaration   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  636 
Error       Compiling transformation: Invalid token '=' in class, struct, or interface member declaration   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  635 
Error       Compiling transformation: Invalid token 'catch' in class, struct, or interface member declaration   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  633 
Error       Compiling transformation: Syntax error, ',' expected    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  633 
Error       Compiling transformation: Syntax error, '[' expected    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: Syntax error, ']' expected    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: The name 'GenerateCollectionElement' does not exist in the current context    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  117 
Error       Compiling transformation: The name 'GetXsdTypeName' does not exist in the current context   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  153 
Error       Compiling transformation: The name 'itemType' does not exist in the current context MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  202 
Error       Compiling transformation: The name 'PopIndent' does not exist in the current context    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  365 
Error       Compiling transformation: The name 'PushIndent' does not exist in the current context   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  348 
Error       Compiling transformation: The name 'WriteLine' does not exist in the current context    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  353 
Error       Compiling transformation: The type or namespace name 'GenerationEnvironment' could not be found (are you missing a using directive or an assembly reference?)   MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: Type expected MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: Type or namespace definition, or end-of-file expected MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 
Error       Compiling transformation: { expected    MyApp.Configuration D:\Dev\MyApp\tools\MyApp.Configuration\JwtAuth.csd  638 

Microsoft Visual Studio Professional 2015 Version 14.0.25420.01 Update 3 Microsoft .NET Framework Version 4.7.02053

neutmute commented 7 years ago

Reproduced this on another machine so seems repeatable. The good news is it works fine in VS2017 so I will just go with that approach

hybridview commented 7 years ago

I'm not sure what could be causing all of those errors in VS2015. Will need to investigate when I have a spare moment. Thanks for reporting.

Sherif-Ahmed commented 7 years ago

Same Issue

VassilTonev commented 6 years ago

Hi there,

first of all, I would like to express my purest admiration of your work Andrew and tell you that your extension has saved me a ton of work.

now to the issue

I had the same issue with Visual Studio Community 2015. The bug is not in the 2017 package, because it is fixed there. The fix is very small and everyone can do it itself. Comparing the file ConfigurationSectionDesignerSchema.tt between the 2015 and 2017 projects, one sees, that a closing bracket is causing the problems configurationsectiondesignerschema with the template file. This is in line 248: } // End loop over all configuration elements. - would be wrong and // End loop over all configuration elements. - fine Additionally there is one other line that was changed for the 2017 package and it is the line number 202: ConfigurationProperty keyProperty = itemType.KeyProperties.SingleOrDefault(); to ConfigurationProperty keyProperty = collectionElement.ItemType.KeyProperties.SingleOrDefault();

Supposing that both corrections have to do with the bug, I simply took the 2017 package file and replaced the 2015 one.

Then after compiling I installed the newly build VS-Extension and (almost) everything worked fine. Almost, because the imports in the templates for xml files resulted in carriage returns, breaking the xml notation. I will now create an issue for this problem and describe how I fixed it for me. Maybe there is a better solution though.

@hybridview : It's a pity that you don't have the time to work on the project, but hey, it is perfect anyway. Really appreciated and if you find time to fix the 2015 version and add a 100% working .VSIX then this would be really nice. My self compiled version works just fine :)

Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.6.01055

Greetings from Cologne, Germany Vasil

VassilTonev commented 6 years ago

Forgot to mention:

For compiling the projects, I had to install the Visual Studio SDK and after that the Modeling SDK for Microsoft Visual Studio 2015.

hybridview commented 6 years ago

The analysis was very helpful. Many thanks! I'll try and get a package for 2015 compiled today.

Regarding time available for this project, I see a lot of people fall into this trap. You have a lot of spare time when you are single and living on your own. Then you get married, buy a house that needs upkeep, and kids start coming along. I've had to put most of my hobbies on hold. Once the kids are a bit older, they will choose to hang out with their friends instead of "Dad", so I think I will start to have a little more time for myself.

Also, I can't take most of the credit for this project. There were developers before me who came up with the idea and did most of the original work. I just continued in their footsteps after they left the project due to lack of free time. This reminds me that I need to post credit to the original authors somewhere in this project. CodePlex is gone, so I need to try and find this information in my email archives.

hybridview commented 6 years ago

I applied the fix to the VS2015 version. I have updated the VS2015 VSIX in latest release on the releases page. Let me know if it does the trick for you.

VassilTonev commented 6 years ago

Hi, sorry it took so long, but I was on vacation and had left the re-test for later. After uninstalling my self-compiled version of the package and then downloading and installing the official VS2015 version from here, I can confirm that the error has vanished. The issue can be closed, I think.