T4Toolbox icon indicating copy to clipboard operation
T4Toolbox copied to clipboard

Add support for VS 2019

Open peterM opened this issue 5 years ago • 24 comments

Hi,

I updated source code of T4Toolbox to be possible use it with VS 2019.

I also think this should not be merged to current repository and instead of this should have its own repository.

I am also not for 100% sure if i changed all needed fields.

Thanks

#59

peterM avatar Apr 04 '19 06:04 peterM

hi @peterM any complied vsix file link?

hippasus avatar Apr 04 '19 16:04 hippasus

hi @hippasus, you just need clone my branch and build it. Then vsix will be saved in bin folder I can provide one but i am not sure if it is right way how to do it. I am new in open source and I do not want to do something wrong way.

peterM avatar Apr 04 '19 19:04 peterM

Thanks for this idea @peterM! I was able to clone, build, and install from the .VSIX as you mentioned. I only have two issues: 1) VS 2019 is complaining about this extension loading synchronously, and 2) I couldn't resolve the error "The service 'Microsoft.Internal.VisualStudio.Shell.Interop.SVsUIThreadInvokerPrivate' must be installed for this feature to work. Ensure that this service is available" when trying to run the tests. But for now, this appears to be a viable short-term solution.

3milio avatar Apr 05 '19 19:04 3milio

Hi @3milio, Thank you for your input. I will try to look on issues. Maybe i will be able to solve them.

Could you more describe 2nd issue (steps to reproduce)? I did not experience it.

peterM avatar Apr 06 '19 05:04 peterM

@peterM, sorry for the delay in responding. I simply chose (in VS 2019) to 'Run All' tests and got the error for just the integration tests. All other tests pass, or are skipped. And this is the error they get.

image

3milio avatar Apr 12 '19 18:04 3milio

@3milio I will try. To be honest on my computer did not work tests .. but when i commited code and pull requests checks triggered build it was after several attempts green :) Also this could be connected with VSSDK. Did you install also VS Extensibility packages?

Last week I tried migrate extension to support Asynchronous loading, but is not so easy to change inheritance from Package to AsyncPackage. I had extension file, but Visual studio started to be unstable and extension unreliable :/

peterM avatar Apr 15 '19 05:04 peterM

BTW: Visual studio 2019.1 will probably stop support loading synchronous packages so it will need to implement AsyncPackage instead of Package

peterM avatar Apr 23 '19 06:04 peterM

new to this GitHub, how do I pull your branch?

ben1628 avatar May 28 '19 12:05 ben1628

new to this GitHub, how do I pull your branch?

execute git clone https://github.com/peterM/T4Toolbox.git

peterM avatar May 28 '19 12:05 peterM

Any way this could get merged or a new repository added so others can access it via VS 2019? Thanks peterM for doing this! I just pulled down your version to run the install and it worked great, but would be nice not to have to do that.

hbailles3 avatar Jul 29 '19 18:07 hbailles3

What is the plan for official release for VS 2019?

imran517 avatar Aug 15 '19 14:08 imran517

Thanks for doing this @PeterM When I loaded the solution on a Win10 / VS2019 dev box, VS complained that it wanted .Net 3.5. I went ahead and it still wouldn't build.

image

Here's the build log:

1>------ Rebuild All started: Project: T4Toolbox, Configuration: Debug Any CPU ------
2>------ Rebuild All started: Project: T4Toolbox.VisualStudio.ItemTemplates, Configuration: Debug Any CPU ------
1>  T4Toolbox -> C:\dev\src\spikes\T4Toolbox\src\T4Toolbox\bin\Debug\T4Toolbox.dll
3>------ Rebuild All started: Project: T4Toolbox.TemplateAnalysis, Configuration: Debug Any CPU ------
4>------ Rebuild All started: Project: T4Toolbox.DirectiveProcessors, Configuration: Debug Any CPU ------
5>------ Rebuild All started: Project: T4Toolbox.Tests, Configuration: Debug Any CPU ------
3>C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\TemplateScanner.partial.cs(39,30,39,37): error CS0115: 'TemplateScanner.yyerror(string, params object[])': no suitable method found to override
3>C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\TemplateScanner.partial.cs(61,47,61,55): error CS0246: The type or namespace name 'ScanBuff' could not be found (are you missing a using directive or an assembly reference?)
3>C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\TemplateScanner.partial.cs(79,33,79,36): error CS0115: 'TemplateScanner.TemplateBuffer.Pos': no suitable method found to override
3>C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\TemplateScanner.partial.cs(85,33,85,37): error CS0115: 'TemplateScanner.TemplateBuffer.Read()': no suitable method found to override
3>C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\TemplateScanner.partial.cs(108,36,108,45): error CS0115: 'TemplateScanner.TemplateBuffer.GetString(int, int)': no suitable method found to override
6>------ Rebuild All started: Project: T4Toolbox.VisualStudio.Editor, Configuration: Debug Any CPU ------
7>------ Rebuild All started: Project: T4Toolbox.TemplateAnalysis.Tests, Configuration: Debug Any CPU ------
6>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\bin\Debug\T4Toolbox.TemplateAnalysis.dll' could not be found
8>------ Rebuild All started: Project: T4Toolbox.VisualStudio.Editor.Tests, Configuration: Debug Any CPU ------
4>  T4Toolbox.DirectiveProcessors -> C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.DirectiveProcessors\bin\Debug\T4Toolbox.DirectiveProcessors.dll
9>------ Rebuild All started: Project: T4Toolbox.VisualStudio, Configuration: Debug Any CPU ------
8>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\bin\Debug\T4Toolbox.TemplateAnalysis.dll' could not be found
8>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio.Editor\bin\Debug\T4Toolbox.VisualStudio.Editor.dll' could not be found
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2114,5): warning MSB3277: Found conflicts between different versions of "Microsoft.Build.Framework" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
9>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\bin\Debug\T4Toolbox.TemplateAnalysis.dll' could not be found
9>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio.Editor\bin\Debug\T4Toolbox.VisualStudio.Editor.dll' could not be found
10>------ Rebuild All started: Project: T4Toolbox.vsix, Configuration: Debug Any CPU ------
5>  T4Toolbox.Tests -> C:\dev\src\spikes\T4Toolbox\test\T4Toolbox.Tests\bin\Debug\T4Toolbox.Tests.dll
11>------ Rebuild All started: Project: T4Toolbox.VisualStudio.Tests, Configuration: Debug Any CPU ------
10>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\bin\Debug\T4Toolbox.TemplateAnalysis.dll' could not be found
10>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio\bin\Debug\T4Toolbox.VisualStudio.dll' could not be found
10>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio.Editor\bin\Debug\T4Toolbox.VisualStudio.Editor.dll' could not be found
12>------ Rebuild All started: Project: T4Toolbox.VisualStudio.IntegrationTests, Configuration: Debug Any CPU ------
7>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\bin\Debug\T4Toolbox.TemplateAnalysis.dll' could not be found
12>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio\bin\Debug\T4Toolbox.VisualStudio.dll' could not be found
12>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio.Editor\bin\Debug\T4Toolbox.VisualStudio.Editor.dll' could not be found
11>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.TemplateAnalysis\bin\Debug\T4Toolbox.TemplateAnalysis.dll' could not be found
11>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio\bin\Debug\T4Toolbox.VisualStudio.dll' could not be found
11>CSC : error CS0006: Metadata file 'C:\dev\src\spikes\T4Toolbox\src\T4Toolbox.VisualStudio.Editor\bin\Debug\T4Toolbox.VisualStudio.Editor.dll' could not be found
========== Rebuild All: 4 succeeded, 8 failed, 0 skipped ==========

SpartanDigitalDotNet avatar Aug 15 '19 18:08 SpartanDigitalDotNet

Here is built extension T4Toolbox.0.0.0.0.zip

peterM avatar Aug 21 '19 12:08 peterM

What is the plan for official release for VS 2019?

Hmm is hard to say because i think original author do not have time to maintain this. Hopefuly someone will take it. Currently i also do not have time to properly migrate this extension to fully support VS2019

peterM avatar Aug 22 '19 05:08 peterM

After installed T4Toolbox.0.0.0.0.zip in vs 2019 preview 16.4.0 there is some problem with include once="true" because "once" attribute is not recognized

niconico49 avatar Sep 27 '19 08:09 niconico49

Thanks @peterM this works for me - although I only use a limited set of features here (basically I use this primarily to trigger a rebuid of a .tt template when an xml file is changed)

I do notice however that it can only be loaded via allowing synchronous packages to load. Is this something that is simple to update?

Also maybe @olegsych could accept and make this official?

mika76 avatar Oct 06 '19 13:10 mika76

Thanks @peterM this works for me - although I only use a limited set of features here (basically I use this primarily to trigger a rebuid of a .tt template when an xml file is changed)

I do notice however that it can only be loaded via allowing synchronous packages to load. Is this something that is simple to update?

Also maybe @olegsych could accept and make this official?

I tried to migrate it to use AsyncPackage what is new way how to integrate extensions into VS but it was not work and i do not have time to fix it.

peterM avatar Jun 01 '20 11:06 peterM

I'm giving it a go based on PeterM's fork. The AsyncPackage is a bit of a bind. In a lot of places the ServiceLocator is passed down into the objects and stored. At a later point, in a synchronous method, it then tries to resolve a service.

Under the AsyncPackage you can't do this, because resolving services becomes an asynchronous process. (GetServiceAsync vs GetService)

So I'm refactoring the relevant objects to accept their dependencies through constructors. I'll do the service resolution asynchronously BEFORE object creation.

Once I've slain that dragon, I'll work out how to get the Visual Studio Integration tests working. MSTest v1 had some special sauce for running those which no longer exists in MSTest v2.

alansingfield avatar Jun 07 '20 09:06 alansingfield

I tried to compile the projects but I have the following problem:

First a compilation error:

            if (commandGroup == VSConstants.VSStd2K && 

VSConstants is not found and I find out that I have to install the package Microsoft.VisualStudio.Shell.Framework. But it seems one its dependencies is not compatible with .NET 4.72:

Install-Package : Could not install package 'Microsoft.ServiceHub.Analyzers 2.6.92'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that framework.

dbalciunas avatar Sep 11 '20 03:09 dbalciunas

I was able to compile it and build the VSIX for Visual Studio 2019. Download it here: http://dl.compdj.us/download/index/T4Toolbox15003VS2019vsix

Rickrat avatar Nov 01 '20 05:11 Rickrat

Install-Package : Could not install package 'Microsoft.ServiceHub.Analyzers 2.6.92'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that framework.

@dbalciunas Have you been able to resolve /work around this issue or found the cause? I'm seing something similar when trying to update nuget packages of another vsix project.

Thanks!

KarloX2 avatar Nov 15 '20 07:11 KarloX2

Install-Package : Could not install package 'Microsoft.ServiceHub.Analyzers 2.6.92'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that framework.

@dbalciunas Have you been able to resolve /work around this issue or found the cause? I'm seing something similar when trying to update nuget packages of another vsix project.

Thanks!

No, I don't. I didn't try anymore. Sorry.

dbalciunas avatar Nov 21 '20 08:11 dbalciunas

No, I don't. I didn't try anymore. Sorry.

Do you think one should open a separate issue on this? Where would be the right place for that?

KarloX2 avatar Nov 21 '20 08:11 KarloX2

Why does this break with every release of Visual Studio? The T4Toolbox is such a great utility for what it does, this is really a pain.

Do we have a working build yet?

bit7 avatar Jun 11 '21 17:06 bit7