Writing Visual Studio Extension (VSIX) with .NET 5.0
Asked Answered
G

1

8

I am working on a VS 2019 Extension that is currently using .NET Framework (4.8). I want to upgrade it to .NET 5.0 but the VSIX project does not support it or any .NET Core version. I want to avoid .NET Standard if at all possible. I can find no info on the next Visual Studio version (2021?) and if .NET 5.0 VSIX projects will be supported or not. I would think Microsoft would be working on this but on the other hand VS is still a 32 bit app. :-) Sorry if this is not the right venue but this is my first question here.

Glaring answered 4/2, 2021 at 22:27 Comment(8)
"I want to upgrade it...but the VSIX project does not support it or any .NET Core version. I want to avoid .NET Standard if at all possible." - you do realise that .NET Standard is nothing but a baseline of all .NET implementions (including .NET Core) that meet the spec at a certain point in time. So if you intended to use .NET Core 3.0 well that's just something that is under the .NET Standard 2.1 banner. Going forward it is just .NET 5, a single implemention for everything. The rest is kinda mootWoolly
Why not just put the majority of your code in a .NET 5 project and reference it from your .NET Framework 4.8 VSIX project?Woolly
Yes, but I want to develop the extension in full .NET 5.0 and not a subset. A VSIX project only supports .NET Framework. Also I think to use .NET Standard the project file needs to be in the SDK format. All of my other sub projects are in SDK format but I don't think I can upgrade the VSIX project file. The VSIX project template has some unique stuff. I will look into that further as I like the SDK project file format. Thanks!Glaring
Like I said, the VSIX project is nothing but the skeleton for code and installer package. Write the rest in a different assembly using whatever you like so long as it can be referened. Why are you so keen to put everything in one project? Best to decouple thingsWoolly
I have decoupled... there are over 20 other class library projects. I found this: #64788421Glaring
I could make the libraries directly referenced by the VSIX project target standard/5.0 but I don't think i can make the VSIX project target standard/4.8, only 4.8. I think I did find a way to convert the VSIX project to SDK format but will need to test further.Glaring
We seem to be talking about the same thing. VSIX project = 4.8. Libraries = Standard x.yWoolly
@MickyD - I tried putting the libraries in .NET 5 and the VSIX project as .NET Framework 4.8. Why am I getting Project '..\GammaFour.DataModelGenerator.Client\GammaFour.DataModelGenerator.Client.csproj' targets 'net5.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.8' ? This looks like exactly what you were suggesting.Moonscape
S
3

Your main extension must be x86 .NET Framework, as it is hosted by the VS process. You could move some your your functions to .NET Standard 2.0, or to a .NET Core 5.0 console app.

Supporting answered 5/2, 2021 at 5:40 Comment(5)
Thanks. I don't think I can take advantage of all of the 5.0 features in a Standard 2.0 library however and I cant run these libraries out of process. I think I will just have to wait for Microsoft to update VS to .NET 5.0 internally. (Hopefully VS 2021)Glaring
Don't hold your breathSupporting
I wont... Its 2021 and VS is still a 32 bit app!Glaring
@Glaring I know it doesn't help, but it's still 2021 and VS is now 64 bit!Blowhole
Finally!!!! VS 2022 is 64 bit but still runs on .NET Framework. (I understand that they don't want to introduce 2 major changes in one rev) I will have to wait at least to the next rev (2024?) for .NET 5 or 6 or whatever Core version there is by then. Still not holding breath.Glaring

© 2022 - 2024 — McMap. All rights reserved.