malware-dev/MDK-SE

VS Community 2022 v17.9.0

tgstyle opened this issue ยท 45 comments

After updating to the latest version of VS Community 2022, I can no longer deploy scripts. It gives the following error -

MDK.Build.BuildException: Error loading script projects from O:\Downloads\Programs\VS\Scripts\Scripts.sln ---> System.InvalidOperationException: Unable to locate the .NET Framework build host at c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\vbcsharp\languageservices\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe - line 206
at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.GetPathToDotNetFrameworkBuildHost()
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.CreateDotNetFrameworkBuildHostStartInfo()
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MDK.Build.BuildModule.d__26.MoveNext() in D:\Repos\SpaceEngineers\MDK-SE\Source\MDK\Build\BuildModule.cs:line 131
--- End of inner exception stack trace ---
at MDK.Build.BuildModule.d__26.MoveNext() in D:\Repos\SpaceEngineers\MDK-SE\Source\MDK\Build\BuildModule.cs:line 138
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MDK.Build.BuildModule.<b__25_0>d.MoveNext() in D:\Repos\SpaceEngineers\MDK-SE\Source\MDK\Build\BuildModule.cs:line 117
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MDK.MDKPackage.d__47.MoveNext() in D:\Repos\SpaceEngineers\MDK-SE\Source\MDK\MDKPackage.cs:line 369

Thank you for letting me know so quickly. Hopefully it's merely a matter of updating packages and rebuilding. I will do my best to remember doing just that when I get home from work.

Unfortunately MS has been having some build issues today, and it would seem this is affected some of the packages I need for MDK too. Which means I won't be able to fix this before they fix their part. I will try to monitor.

Thanks for the updates on the status.

I get this error too.
Are there any workarounds we can use?

Well, they fixed the packages. But they've broken something else I can't figure out just yet. Working on it.

Thank you much appreciated.

I am sorry to say, that even after hacking my way around what they broke, and installing all new packages etcetera...

the original problem, with the build failing, remains. This is a bigger problem than I thought.

I just wanted to let you guys know that while I have not been able to solve the actual issue (MS has deleted something), I am working on a way around it. At this moment I can't say how much time it'll take, but I promise I'm doing my best.

Great, thank you so much :)

I just found out that Microsoft has significantly simplified the process of rolling back Visual Studio. If this is an option for you, you can open your Visual Studio installer and find the Roll Back menu item under the More button.

This might tide you guys over until I either figure out how to solve what they broke, or finish MDK2... one of the two.

I saw that too. Unfortunately, trying to troubleshoot the issue. I removed and reinstalled VS completely. So, I don't have that option. Thanks for your work on this.

Thanks for the tip - I thought that was for non-community editions only :)
I might give that a try.

Unfortunately I don't have that "Roll Back" option under the "More" menu.
I can't seem to find a way to download specific versions of VS Community edition, looks like that is a pro/enterprise feature.
Am I missing something?
Also please let me know if there is anything I can do to help :)

It's not a pro/enterprise feature. I run Community Edition at home specifically to make sure I don't do something that requires a paid VS version.

I very much appreciate the offer to help, but right now I just need to write code.

At this moment I don't know any other solution but to finish MDK2 - which is not integrated with Visual Studio at all, and as such doesn't suffer from this issue.

At least, my goal no. 1 is to get the deployer console app complete enough that you guys can use it as a workaround for the missing deploy in MDK1, then I will have a second look on whether I can actually fix it somehow. Since it'll definitely be a while until MDK 2 is fully complete.

Thanks again, I really appreciate your work and effort.

This is what it looks like for me:
vs2022missing_rollback

Am I doing something wrong here?

As far as I'm aware, like tgstyle noticed, you will only get this option if you've just updated your VS. If you've done anything else - if this is a new install, for instance - you don't get the rollback.

Yeah that is unfortunate. I did actually just update, but it was from a very old version.
Thanks again malware.

Please vote:
https://developercommunity.visualstudio.com/t/Something-got-deleted-when-VS-updated-b/10598067

While I am still working on MDK2 - and the tool required to work around this is almost ready - the best solution for existing users would be to have this fixed, as MDK2 is quite a different kind of beast.

Thanks for the update - voted.

There is now a nuget package early alpha of the MDK2 packager.

Mal.Mdk2.PbPackager

This should be deploying your scripts every time you build.

Of course, being an early alpha, it's likely riddled with problems.

Please make issues prefixed with [MDK2] - I will take both suggestions and bug reports at this time.

I am dependent on whoever may be willing to help.

Some limited instructions are available at https://www.nuget.org/packages/Mal.Mdk2.PbPackager/

I'm sure this wasn't planned, but it works with Rider too, which makes me happy.

I'm sure this wasn't planned, but it works with Rider too, which makes me happy.

It was absolutely planned. Rider is my primary.

Thanks @malware-dev - it works as intended, at least for my simple projects, I haven't tested more exotic scenarios but for the basics it works.

Make sure you update to at least Alpha 31. There was a rather ugly infinite-loop bug in 30.

so sorry new to all this got visual studio installed and sorted getting same bug as every one at listed at top ,
i have read the instructions at https://www.nuget.org/packages/Mal.Mdk2.PbPackager/
i understand them fully , but what do i do with the file Mal.Mdk2.PbPackager , never used anything like this before i guess it just a patch or something

It is not a patch. I cannot fix the built-in deploy.

I am still working on MDK2 which this workaround is a part of, and will eventually supercede MDK1 completely.

cheers malware thank you,

**Update all sorted now thank you for pointing me in right direction

Please help me decide how MDK2 should be configured

If you use the new workaround MDK2 package, please answer this poll:

https://strawpoll.com/3RnYl5ERBye

Any chance you could default to Lite minify or similar until you get a chance to make it configurable?

There is no minifier at all yet.

I'm sorry, I'm doing my best here, but I do have a day job as well ๐Ÿ˜„

To explain:

In order for me to move on to the minifiers (which do need to be rewritten for MDK2) I need to nail down the basic function of how the program itself needs to work. I'm not quite there yet.

Oh, all good. Don't mind me ๐Ÿ˜

Just joined the SE scripting party, MDK2 works well for me, it just failed the first build then started working.

Just joined the SE scripting party, MDK2 works well for me, it just failed the first build then started working.

May I ask what the first failure was?

I would like to receive detailed instructions on how to install alpha MDK2

I would like to receive detailed instructions on how to install alpha MDK2

Presuming you are using this to work around the problems with MDK1:

Right-click your MDK1 project
Select "Manage Nuget Packages"
Find the search field. To the right of it, there's a checkbox named "Include prerelease". Check it, then type in Mal. in the search field.
Install the Mal.Mdk2.PbPackager package in your project

Rebuild.

From now on, your script will be published every time you build, you will no longer need to use the Publish function.

Just joined the SE scripting party, MDK2 works well for me, it just failed the first build then started working.

May I ask what the first failure was?

I just installed Visual Studio 2022 Community, followed your Getting Started started directions, followed the "Install the Mal.Mdk2.PbPackager package in your project" directions, and hit the "Build Solution" button and got the error that I assume @kelno got. It was the following:

Severity	Code	Description	Project	File	Line	Suppression State
Error		The command ""C:\Users\jesse\source\repos\TheMaw\packages\Mal.Mdk2.PbPackager.2.0.0-alpha073\build\..\tools\mdk.exe" restore "C:\Users\jesse\source\repos\TheMaw\TheMaw\TheMaw.csproj" -interactive" exited with code -1.	TheMaw	C:\Users\jesse\source\repos\TheMaw\packages\Mal.Mdk2.PbPackager.2.0.0-alpha073\build\Mal.Mdk2.PbPackager.props	33	

If I just hit the "Build Solution" button again, the error goes away and the script is successfully deployed. This is so easy! Thank you! In the game I just Browse Scripts, select my script, and hit Copy to Editor button and it's ready to rock.

Sorry I missed the question. I don't remember now. But I definitely only had to just hit build a second time to make it go away. Good chance it's the same one described in last message.

@jpangburn @kelno It would be great to get the actual error output from that (not the Error list, but the build output)

Here goes, I reinstalled everything on a new computer.
I did create a new project, tried to build and failed. Then installed the new nugget package via the package manager. Then hit build and got:

1>------ Build started: Project: IngameScript2, Configuration: Debug x64 ------
1>  MDK is converting legacy ingame script project: IngameScript2
1>  The project has been successfully converted to MDK2.
1>  The Mal.Mdk2.PbPackager nuget package could not be found on the nuget web site.
1>C:\Users\Patipa\source\repos\IngameScript2\packages\Mal.Mdk2.PbPackager.2.0.0-alpha073\build\Mal.Mdk2.PbPackager.props(33,9): error MSB3073: The command ""C:\Users\Patipa\source\repos\IngameScript2\packages\Mal.Mdk2.PbPackager.2.0.0-alpha073\build\..\tools\mdk.exe" restore "C:\Users\Patipa\source\repos\IngameScript2\IngameScript2\IngameScript2.csproj" -interactive" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 11:08 and took 01,486 seconds ==========

Then it worked on second build.

Thank you very much, @kelno .

@kelno @jpangburn This looks to me to be directly related to the hybrid solution currently in use, the attempt to make it auto-upgrade MDK1 projects enough that MDK2 can run. Since it "corrects itself" I don't think I'm gonna spend any time on trying to fix it, unless it starts causing real issues.

work around for the initial bug that broke MDK1

#323 (comment)