Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension fails to work in 15.8 Preview 3 #127

Open
CoolDadTx opened this issue Jun 29, 2018 · 19 comments
Open

Extension fails to work in 15.8 Preview 3 #127

CoolDadTx opened this issue Jun 29, 2018 · 19 comments

Comments

@CoolDadTx
Copy link

Taking a simple script and trying to run the custom tool via the extension in 15.8 Preview 3 fails. The error is:
System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace' from assembly 'Microsoft.CodeAnalysis.Workspaces.Desktop, Version=2.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at Scripty.Core.ScriptEngine.d__6.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at Scripty.Core.ScriptEngine.Evaluate(ScriptSource source)
at Scripty.ScriptyGenerator.GenerateCode(String inputFileContent) in E:\Code\Scripty\src\Scripty.CustomTool\ScriptyGenerator.cs:line 58

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class AppSettings
{
}
@daveaglick
Copy link
Owner

I'm not totally surprised. Scripty is a little behind the times right now. I've been working a ton over in https://github.com/daveaglick/Buildalyzer to make sure I can build any type of project from any type of host. That project serves as a foundation for Scripty and is important because being able to build the host project so that we can introspect it is the fundamental goal of Scripty. Once that project is stable enough, I'm going to circle back to Scripty and update it for the most recent versions of MSBuild and Roslyn.

@MelGrubb
Copy link

The Visual Studio extenstion seems to be entirely missing at this point. Is this related? I just ran into a limitation with a set of T4 templates that I've used for years, and was looking for some way to keep them alive in the .Net Core space. That doesn't look possible, so I thought I'd rewrite them in Scripty. I'm not getting anything though. No output or complaints from the MSBuild NuGet package. Nothing. I'd like to try the extension, but it's seemingly AWOL at the moment.

@daveaglick
Copy link
Owner

Sorry about that. I removed it for now. Scripty is in need of an update (which I fully intend to do sometime this year), but in the meantime there were reports of the vsix breaking Visual Studio. Since I don't have time to look closer at it right now, I unlisted the package lest it get swamped with bad reviews. The MSBuild package should still work though, and you could build the vsix from source and locally install it if you really need to.

If you're not seeing anything from the build output and Scripty isn't generating files, perhaps you're in a newer scenario I haven't tested yet. Are you using a SDK-style project or is it .NET Core? Those will be supported in the future, but I honestly don't know how well they'll work right now.

Keep an eye out for a new Scripty rewrite, probably sometime in the last couple months of the year.

@MelGrubb
Copy link

MelGrubb commented Jul 25, 2018 via email

@dude0001
Copy link

dude0001 commented Aug 20, 2018

Can you put the extension back up on the marketplace, or can you provide an alternate link to download the extension? Removing the extension has essentially crippled anyone still using this in VS versions prior to 15.8. We are still using this on production environments and we need to be able to set this up on new development machines using an older VS version for those that have updated to 15.8. I'm scrambling today to try to find a machine that hasn't been updated to VS 15.8 and has the extension installed.

Regarding the actual issue, it looks like MS actually broken multiple packages that use MSBuildWorkspace and they have fixed the issue. It looks simple as just updating this new version dotnet/roslyn#29334

@daveaglick
Copy link
Owner

@dude0001

Removing the extension has essentially crippled anyone still using this in VS versions prior to 15.8

Definitely don't want to cause problems for existing Scripty users. I know it's been a long time since an update, but I'm still planning on updating and rewriting Scripty for a 1.0 release soonish (I swear!) Some of the pieces like Buildalyzer are finally falling into place.

Can you put the extension back up on the marketplace, or can you provide an alternate link to download the extension?

I'm very hesitant to add it back to the gallery since there's been reports of breaks and I can't guarantee it'll work on newer versions of Visual Studio at this point. However, I've added the VSIX to the 0.7.4 release here on GitHub so anyone who needs/wants it can download it until the next release gets added back to the gallery.

Regarding the actual issue, it looks like MS actually broken multiple packages that use MSBuildWorkspace and they have fixed the issue.

At this point, MSBuildWorkspace is a non-started for Scripty use. It was totally broken for a long time (hence my break here to focus on Buildalyzer), and still remains broken for all but the most simple scenarios. For example, it doesn't work at all under a .NET Core host. Buildalyzer resolves some of these issues (though it's not perfect), so the next version of Scripty will use it and a Roslyn AdhocWorkspace instead of MSBuildWorkspace.

@dude0001
Copy link

Thank you for the link to the VSIX, didn't think to look there. I think that will help us work around this for now but very much looking forward to a fix so we can continue to use Scripty.

@alphaleonis
Copy link

alphaleonis commented Sep 27, 2018

I encountered the same error on one of my own extensions. Apparently there doesn't seem to be a good way to make an extension that is compatible with both 15.8 and earlier versions. See dotnet/roslyn#29334 for more info.

(As a summary, they moved the MSBuildWorkspace into a new assembly without type forwarding, which requires us to reference the 2.9.0 version of Microsoft.CodeAnalysis assemblies to use it on VS 15.8)

@InvalidCast44
Copy link

any news please?

@daveaglick
Copy link
Owner

@InvalidCast44 Nope.

My thinking is still about the same as it was - I'm still planning on circling back to Scripty at some point, though I don't have an estimate on when or how soon that'll be ("soonish" may have been a bit optimistic). I have other higher-priority OSS work at the moment that'll keep me busy into the immediate future.

@InvalidCast44
Copy link

i quickly tried to recompile your code, adding the new missing package "microsoft.codeanalysis.workspaces.msbuild" but i get this error in Scripty.CustomTool:

CreatePkgDef : error : ProvideBindingRedirectionAttribute: Invalid value specified for NewVersion.

i would like to have a "crappy" version of my own on my machine, but this block me.
any ideas?

@InvalidCast44
Copy link

i finally managed to get your extension work with vs 15.8.9 :-)
i had problems with vsix: i couldn't register custom tool
i created another vsix:

  • with vsix template
  • add Microsoft.VisualStudio.TextTemplating.VSHost.15.0 package
  • add an async package via "new item"

and this time it worked.

so basically, adding "microsoft.codeanalysis.workspaces.msbuild" package is all you need to make scripty work again.
for the moment i will use my crappy extension, it does the job (thanks to your code obviously :-) )

@KCarterSr
Copy link

InvalidCast44 , can I get a copy of your vsix?

Thanks

@KCarterSr
Copy link

Anybody know how to get in touch with InvalidCast44. I need this baaad.

@InvalidCast44
Copy link

if it's ok with daveaglick i can post a link to download modified sources + compiled vsix

@daveaglick
Copy link
Owner

Fine with me - I really appreciate you filling in the gap until I’ve got time to revisit.

@InvalidCast44
Copy link

it's a little thing compared to what you've done for us ;-)
please remind that it's a quick fix, it was not intented to be released to anyone but me
http://dl.free.fr/b7ElBRNUC
contains modified git clone + compiled vsix
AFAIR i change some description string to be sure my version was the one that was registered.
but anyway, the most important is that custom tool "ScriptyGenerator" is still registered

@KCarterSr
Copy link

Man, thanks so much. Im fed up with tools for T4. All the good tools except for ForTea have gone bust. And ForTea takes soooo long for updates to come out each time Resharper is updated, I end up waiting for sometimes months before I can continue using it for my code.

K. L. Carter Sr.

@bradtwurst
Copy link

We've used scripty in the past to generate code and it's been a very useful tool.

Since visual studio has been updated, the extension was no longer working.

Calling the scripty.exe worked but, to simplify calling the .exe, we would end up regenerating all the .csx output on each change that we wanted to capture.

I've created a fork of scripty with a 'vs2019' branch in which I've gone through and 'updated' the code to work in our situation (vs2019 - framework - not core at this time)

It appears to be working (on my machine), but I don't know if it is worth a pull request as it could not work on older visual studios with the changes I've done.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants