private void BuildEvents_ProjectBuildDone(ProjectBuildDoneEventArgs eventArgs) { if (messages == null) { messages = new MessageAdapter(); } if (!eventArgs.IsSuccessful) { return; } try { // projectName can be like 'path\path\abc.def, where abc.def is the project name in the // solution explorer Project project = eventArgs.Project; ConfigurationOptions options = new ConfigurationOptions(project); if (!options.EnableAddIn) { messages.WriteLine("NDO Add-in disabled"); return; } messages.WriteLine(String.Format(EnhDate.String, "NDO Extension", new AssemblyName(GetType().Assembly.FullName).Version.ToString())); ProjectDescription projectDescription = new ProjectDescription(project); string projFileName = options.FileName; CheckProjectDescription(options, projectDescription, projFileName); string targetFramework = projectDescription.TargetFramework; // .NETCoreApp,Version=v2.0 müsste beim Überprüfen ebenfalls gültig sein. //if (!string.IsNullOrEmpty( targetFramework ) && (!targetFramework.StartsWith( ".NETFramework,Version=v4" ) && !targetFramework.StartsWith( ".NETStandard,Version=v2" ))) //{ // messages.ShowError( "Project " + project.Name + " has been built with " + targetFramework + ". NDO requires .NETFramework 4.x or .NET Standard. You need to reconfigure your project." ); // messages.WriteInsertedLine( targetFramework ); // project.DTE.ExecuteCommand( "Build.Cancel", "" ); // messages.ActivateErrorList(); // return; //} // ------------------ MsBuild Support ----------------------- if (eventArgs.IsSuccessful || options.UseMsBuild) { IncludeFiles(options, project, projectDescription); } } catch (System.Exception ex) { messages.WriteLine("*** Enhancer Add-in Error: ***"); if (!(ex is EnhancerEmptyException)) { messages.WriteLine(ex.ToString()); } if (ex is System.Runtime.InteropServices.COMException) { messages.WriteLine("An error in the Visual Studio automation system occured. The error should disappear after a restart of Visual Studio."); } else { messages.WriteLine(""); messages.WriteLine("This is possibly a follow-up error. Look at error messages above this line."); } } }