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

An error occurred:SetSite failed for package [EFCorePowerToolsPackage]Source: 'EFCorePowerTools' Description: 未能加载文件或程序集“EnvDTE, #1046

Closed
kakalotte opened this issue Jul 17, 2021 · 84 comments

Comments

@kakalotte
Copy link

SetSite failed for package [EFCorePowerToolsPackage]Source: 'EFCorePowerTools' Description: 未能加载文件或程序集“EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。系统找不到指定的文件。
System.IO.FileNotFoundException: 未能加载文件或程序集“EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。系统找不到指定的文件。
文件名:“EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
在 EFCorePowerTools.EFCorePowerToolsPackage.d__11.MoveNext()
在 System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
在 EFCorePowerTools.EFCorePowerToolsPackage.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress)
在 Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass20_0.<b__1>d.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Microsoft.VisualStudio.Threading.JoinableTask.d__76.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)
在 Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)

EF Core Power Tools version:2.5.692

Visual Studio version: Microsoft Visual Studio Enterprise 2022 Preview (64 位)

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 17, 2021

What happens before you got this error??

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 17, 2021

Could you try the latest daily?

@kakalotte
Copy link
Author

kakalotte commented Jul 17, 2021

ActivityLog.zip

the log of VS2022 about this error.

the daily build (version 2.5.714) also has the same error.

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 17, 2021

No idea, could be a VS2022 issue/bug.
Are you running VS 2022 preview 2?

What OS language and VS language?

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 17, 2021

I am not able to repro! @madskristensen ??

@kakalotte
Copy link
Author

kakalotte commented Jul 17, 2021

Yes,I'm using  VS 2022 preview 2.
the OS and VS language is All Chinese

@madskristensen
Copy link

Known bug in Preview 1 that was fixed in Preview 2 of VS2022

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 17, 2021

But @kakalotte claims to be running preview 2!

@kakalotte
Copy link
Author

kakalotte commented Jul 18, 2021

Known bug in Preview 1 that was fixed in Preview 2 of VS2022

Using a brand new computer, there is no problem after reinstall the win10 system and vs2022 preview 2 software.

My old computer still has this problem. Is there any temporary solution?@madskristensen

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 18, 2021

Closing as external VS issue

@TimKras
Copy link

TimKras commented Aug 12, 2021

Known bug in Preview 1 that was fixed in Preview 2 of VS2022

Still not fixed in my version (using Preview 3 of VS2022).
Already completly uninstalled VS2022, but problem still exists.

@TimKras
Copy link

TimKras commented Aug 12, 2021

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 12, 2021

@madskristensen Is there something I can do in Power Tools?

@madskristensen
Copy link

Did you get rid of all uses of DTE and replaced them with DTE2?

@ErikEJ ErikEJ reopened this Aug 12, 2021
@ErikEJ
Copy link
Owner

ErikEJ commented Aug 12, 2021

@TimKras Can you share your activitylog? Or full error stack?

@madskristensen
Copy link

Ok, i think i figured it out from having the same issue in one of my extensions. I was referencing the old Private Interop Assemblies for the EnvDTE. When I changed to using PackageReferences and the Microsoft.VisualStudio.SDK (or toolkit) package it worked. Or so it seems

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 12, 2021

@ankitvarmait
Copy link

ankitvarmait commented Aug 12, 2021

By upgrading the package
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.0.206" /> to the latest should remove the dependency of EnvDTE, Version=8.0.0.0

https://github.com/ErikEJ/EFCorePowerTools/blob/master/src/GUI/EFCorePowerTools/EFCorePowerTools.csproj

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 12, 2021

@ankitvarmait Well spotted, thanks!

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 12, 2021

@TimKras @kakalotte I attempted a fix in the latest daily build, are you able to give that a try?

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 12, 2021

@ankitvarmait What if my extension also target VS 2017 (Using SDK 15.0.1) ? (My two other extensions does that currently)

@ankitvarmait
Copy link

ankitvarmait commented Aug 12, 2021

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 12, 2021

@ankitvarmait can I drop support for VS 2017, and just use the latest 2019 SDK?

I cannot publish multiple extensions to same Marketplace entry yet, can I?

@TimKras
Copy link

TimKras commented Aug 12, 2021

Latest daily build does not fix the issue.

image

<entry>
    <record>2548</record>
    <time>2021/08/12 21:14:46.420</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [EFCorePowerToolsPackage]Source: &apos;EFCorePowerTools&apos; Description: Could not load file or assembly &apos;EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies.
The system cannot find the file specified.&#x000D;&#x000A;System.IO.FileNotFoundException: Could not load file or assembly &apos;EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies.
The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;&#x000D;&#x000A;  
at EFCorePowerTools.EFCorePowerToolsPackage.&lt;InitializeAsync&gt;d__11.MoveNext()&#x000D;&#x000A;  
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine&amp; stateMachine)&#x000D;&#x000A;  
at EFCorePowerTools.EFCorePowerToolsPackage.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress)&#x000D;&#x000A;   
at Microsoft.VisualStudio.Shell.AsyncPackage.&lt;&gt;c__DisplayClass20_0.&lt;&lt;Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize&gt;b__1&gt;d.MoveNext()&#x000D;&#x000A;
--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   
at Microsoft.VisualStudio.Threading.JoinableTask.&lt;JoinAsync&gt;d__76.MoveNext()&#x000D;&#x000A;
--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;  
at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)&#x000D;&#x000A;  
at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)&#x000D;&#x000A;&#x000D;&#x000A;
WRN: Assembly binding logging is turned OFF.&#x000D;&#x000A;To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.&#x000D;&#x000A;
Note: There is some performance penalty associated with assembly bind failure logging.&#x000D;&#x000A;To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].&#x000D;&#x000A;</description>
    <guid>{F4C4712C-CEAE-4803-8E52-0E2049D5DE9F}</guid>
    <hr>80070002</hr>
    <errorinfo></errorinfo>
  </entry>

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 13, 2021

@TimKras thanks!

I am going to wait and see, as I am not able to repro on my machine and according to @madskristensen publishing a mixed extension should be possible.

What other extensions do you have installed in VS 2022?

What other VS versions do you have installed?

@Tim-Maes
Copy link

I don't know where I can reach out to you exactly @ErikEJ, but my WIP is here Tim-Maes/T4Executer#4

I'm not sure if I'm able to publish a VS2022 and a VS2019 VSIX file from one single solution

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 24, 2022

@Tim-Maes I publish a VS 2022 and VS 2019 VSIX from the same solution, so it can be done.

Look at my VSIX manifest file: https://github.com/ErikEJ/EFCorePowerTools/blob/master/src/GUI/EFCorePowerTools/source.extension.vsixmanifest#L22

The main point is to stop using EnvDTE and replace with methods from VS Community Toolkit version 16.

See for example: https://github.com/ErikEJ/EFCorePowerTools/blob/master/src/GUI/Shared/Extensions/ProjectExtensions.cs

@Tim-Maes
Copy link

I removed all EnvDTE references, and install the Toolkit in both vsix projects, but the code that uses EnvDTE has been moved to a shared library (as by the official documentation example) which for some reason can't reference the toolkit and still needs EnvDTE to find 'Project' objects.

There must be something I don't understand or completely miss at this moment

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 24, 2022

You do not actually need the shared project. But a shared project works fine for me with the Toolkit.

If you have a branch with the current code I am happy to take a look.

@Tim-Maes
Copy link

WIP on this is right here. Thanks in advance.

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 24, 2022

Confused - I see two VSIX projects ?? And no references to the Toolkit ??

What should be the goal ? Get T4Executer project working in VS 2022 - or publish a dual target VSIX?

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 24, 2022

If goal is just "Get T4Executer project working in VS 2022" things become much simpler.

@Tim-Maes
Copy link

Tim-Maes commented Aug 24, 2022

According to the official docs I had to create a VSIX project that targets VS2022 and move all code to a shared library. When I build in release mode TTExecuter now generates an VSIX for VS2019 and T4Executer for VS2022.
The goal is to have an working VSIX for VS2022 indeed.

You see no references to toolkit since I am still trying locally and not comitted yet

As described here

@ErikEJ
Copy link
Owner

ErikEJ commented Aug 24, 2022

You need to switch to the Community Toolkit events, they no longer work with DTE: VsixCommunity/Community.VisualStudio.Toolkit#63

@JosephWJMaxwell
Copy link

image
Getting same error as others

480 2023/07/12 14:37:01.849 Error VisualStudio SetSite failed for package [EFCorePowerToolsPackage]Source: 'EFCorePowerTools' Description: Method not found: 'Microsoft.VisualStudio.Threading.JoinableTaskFactory Microsoft.VisualStudio.Shell.ThreadHelper.get_JoinableTaskFactory()'. System.MissingMethodException: Method not found: 'Microsoft.VisualStudio.Threading.JoinableTaskFactory Microsoft.VisualStudio.Shell.ThreadHelper.get_JoinableTaskFactory()'. at EFCorePowerTools.EFCorePowerToolsPackage.<InitializeAsync>d__11.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at EFCorePowerTools.EFCorePowerToolsPackage.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress) at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass21_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) {F4C4712C-CEAE-4803-8E52-0E2049D5DE9F}
0x80131513

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 12, 2023

@JosephWJMaxwell which exact VS version?

@tpumper
Copy link

tpumper commented Jul 12, 2023

@JosephWJMaxwell which exact VS version?

@ErikEJ I am getting the same issue in VS 2022

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 12, 2023

@tpumper sure, but which version exactly ?? 17.x.x - check Help, About menu

@iivsimeonov
Copy link

The same error and log file on my site. Version 2022 - 17.4.0

@tpumper
Copy link

tpumper commented Jul 12, 2023

@tpumper sure, but which version exactly ?? 17.x.x - check Help, About menu

@ErikEJ 17.4.1

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 12, 2023

Please Update to the latest version 17.5.6 and let me know the outcome

@tpumper
Copy link

tpumper commented Jul 12, 2023

@ErikEJ That worked. Thank you for the guidance.

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 12, 2023

You are welcome, not sure what is going on here - @madskristensen any idea?

@ErikEJ ErikEJ reopened this Jul 12, 2023
@madskristensen
Copy link

@ErikEJ Looks like it can't find a method on the JTF or perhaps the JTF itself. That's odd. @AArnott any idea?

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 12, 2023

@madskristensen yes, and it seems to be an issue with 17.4 (and maybe earlier) , not 17.5

@madskristensen
Copy link

Are you using 17.0.x versions of the SDK NuGet packages and not 17.5.x or newer?

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 12, 2023

@madskristensen I am using the implicit reference via Community Toolkit. It is advisable to use 17.5 SDK explicitly?

@AArnott
Copy link

AArnott commented Jul 12, 2023

Referencing EnvDTE 8.0.0.0 on VS 2022 is not supported. With the change to 64-bit, we made interop-incompatible changes to fix bitness issues in these assemblies and require everyone to recompile. While some extension authors find that they may get away without doing this, this may very well be one of those cases where it really is necessary. And we don't have capacity to offer help for a scenario that is officially unsupported.

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 13, 2023

@AArnott Thanks, I am not doing that, please read the last entries in this thread. I will add an explicit SDK ref

@ErikEJ ErikEJ closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2023
@AArnott
Copy link

AArnott commented Jul 14, 2023

Ah, it was a very long thread so I just read the description, you're right. But I see you've closed the issue too, so should I still read through everything?

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 14, 2023

@AArnott I am so sorry, someone hijacked this old unrelated thread, and I got confused.

This thread is the current issue (and luckily much shorther). Looking at the VSIX now I can see that the SDK libraries are included as files - is that expected?

@AArnott
Copy link

AArnott commented Jul 14, 2023

Awesome. That makes more sense. I'll hop over to that thread and reply.

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