ConfigurationSectionDesigner icon indicating copy to clipboard operation
ConfigurationSectionDesigner copied to clipboard

Doesn't work with new csproj format

Open gakus opened this issue 6 years ago • 9 comments

When I create new project with new simplified format csd cannot generate contet.

===================

07.05.2019 10:12:06
Recoverable
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The "Compile" rule is missing the "AutoGen" property.
   at Microsoft.Verify.Operation(Boolean condition, String unformattedMessage, Object arg1, Object arg2)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.DynamicTypeBrowseObject.<<VSLangProj-FileProperties-get_IsCustomToolOutput>b__38_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func`1 asyncMethod, JoinableTaskCreationOptions creationOptions)
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously[T](Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.DynamicTypeBrowseObject.VSLangProj.FileProperties.get_IsCustomToolOutput()
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.DynamicTypeBrowseObject.VSLangProj80.FileProperties2.get_IsCustomToolOutput()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAPropertyInfo.get_Value()
   at Microsoft.VisualStudio.Modeling.Shell.SubordinateFileHelper.GetChildProjectItemIds(IVsHierarchy parentHierarchy, UInt32 parentItemId)
   at Microsoft.VisualStudio.Modeling.Shell.SubordinateFileHelper.GetChildProjectItemFileNames(IVsHierarchy parentHierarchy, UInt32 parentItemId)
   at Microsoft.VisualStudio.Modeling.Shell.DocData.QuerySaveFile(String fileName, tagVSQuerySaveFlags querySaveFlags)
   at Microsoft.VisualStudio.Modeling.Shell.DocData.SaveDocData(VSSAVEFLAGS flags, String& fileName, Int32& saveCanceled)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass685_0.<<SaveItem>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass571_0.<<HrMutate>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously[T](Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass568_0.<HrInvoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(Func`1 action, IServiceProvider vsShellServiceProvider, IProjectFaultHandlerService projectFaultHandlerService, UnconfiguredProject project)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
===================

gakus avatar May 07 '19 08:05 gakus

I never tried it in a brand new project. I will take a look.

hybridview avatar Jun 12 '19 16:06 hybridview

Hi, since it sounds like you are moving to the new project format, may I recommend that you take a look at the new Configuration API https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-2.2 from Mircosoft. I have had good success with it and I find it solves most of the problems that would lead you to use this extension. Don't get me wrong, I really like this extension and I still have projects that need it, so please continue, but I am just making a suggestion.

Here is a link on how you would use it in a .Net 4.6 app: https://benfoster.io/blog/net-core-configuration-legacy-projects

God Bless!

Yours truly, Garwin Pryce.

On Wed, Jun 12, 2019 at 11:44 AM Andrew M [email protected] wrote:

I never tried it in a brand new project. I will take a look.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hybridview/ConfigurationSectionDesigner/issues/14?email_source=notifications&email_token=AAENQWZZ2FUJWY3DLGZHAIDP2ERVRA5CNFSM4HLGNU32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXRCAHI#issuecomment-501358621, or mute the thread https://github.com/notifications/unsubscribe-auth/AAENQW7E3MQ4AYQU4DR7WVDP2ERVRANCNFSM4HLGNU3Q .

Garwin4j avatar Jun 12 '19 16:06 Garwin4j

@gakus I created a new WebForms project in latest Visual Studio 2019 and could not reproduce this problem. Some more info would be helpful.

  • What type of project (ClassLibrary, AspNetCore, etc)?
  • .NET framework version.
  • Visual Studio version.

-Thanks

@Garwin4j Thanks for sharing. I actually use the new config model for a few of my new projects as well. The primary purpose of this tool was to be able to visualize the configuration hierarchy and have a nice UI to help with managing types. I think that this could also apply to the new AspNetCore config style. We just need to add this support to ConfigurationSectionDesigner. This is likely not a simple task, so I am hoping that other developers might assist. My time is limited at the moment.

hybridview avatar Jun 12 '19 20:06 hybridview

It doesn't matter whitch version of VS and type of project. By default VS generates old format for all framework version. Only for .net standard and core it generates new version.

Generate new ClassLibrary and replace csproj content with this:

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net472</TargetFramework> </PropertyGroup> </Project>

gakus avatar Jun 13 '19 04:06 gakus

@hybridview did you had a time to look at this? This is keeping me in work from migrating whole test framework to new project.

gakus avatar Jul 09 '19 06:07 gakus

My apologies. It's been a hectic summer and I somehow missed these requests. I'll take another look.

hybridview avatar Aug 28 '19 22:08 hybridview

Thanks sir

On Wed, Aug 28, 2019, 5:14 PM Andrew M [email protected] wrote:

My apologies. It's been a hectic summer and I somehow missed these requests. I'll take another look.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hybridview/ConfigurationSectionDesigner/issues/14?email_source=notifications&email_token=AAENQW6JDT2EVV2NYYWD7YDQG32FDA5CNFSM4HLGNU32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5MUDSY#issuecomment-525943243, or mute the thread https://github.com/notifications/unsubscribe-auth/AAENQW6YJG7UM2QVU6XN5E3QG32FDANCNFSM4HLGNU3Q .

Garwin4j avatar Aug 28 '19 23:08 Garwin4j

I did as gakus suggested. Created new ClassLibrary (For netstandard to ensure new project format). I did this in the latest build of Visual Studio 2019. I then replaced project content with net472 as indicated. Next, I added a new CSD file and created a simple Configuration section. I added a single property. The CSD files generate with no issue for me. I wonder if it has something to do with other projects in your solution. If you have time, could you please try to reproduce the issue with a new empty solution, zip it, and share so I can reproduce on my machine? Many thanks.

hybridview avatar Aug 29 '19 14:08 hybridview

Here is my solution folder that worked successfully for me. If it fails on your machine, then that really helps narrow the problem down for me. CSDNewProjFormatTest_vs2019.zip

hybridview avatar Aug 29 '19 14:08 hybridview