Receiving "The 'AddAnyFilePackage' package did not load correctly." error in VS2022
See original GitHub issueInstalled product versions
- Visual Studio: 2022 Enterprise Preview 1
- This extension: 3.5.159
Description
Receiving “The ‘AddAnyFilePackage’ package did not load correctly.” error in VS2022 when attempting to create a new file (Shift-F2).
Steps to recreate
- Type Shift-F2 to invoke the extension
- Receive the above error dialog.
Current behavior
Receiving the error dialog instead of receiving the dialog for creating the new file/folder.
Expected behavior
Receive the dialog for creating a new file/folder.
Relevant ActivityLog entries
<entry> <record>2697</record> <time>2021/06/23 15:48:20.780</time> <type>Information</type> <source>VisualStudio</source> <description>Begin package load [AddAnyFilePackage]</description> <guid>{27DD9DEA-6DD2-403E-929D-3FF20D896C5E}</guid> </entry> <entry> <record>2698</record> <time>2021/06/23 15:48:20.790</time> <type>Error</type> <source>VisualStudio</source> <description>SetSite failed for package [AddAnyFilePackage]Source: 'AddAnyFile' Description: Could not load file or assembly 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 at MadsKristensen.AddAnyFile.AddAnyFilePackage.<InitializeAsync>d__4.MoveNext()
 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
 at MadsKristensen.AddAnyFile.AddAnyFilePackage.InitializeAsync(CancellationToken cancellationToken, IProgress
1 progress)
at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass20_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)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
</description>
<guid>{27DD9DEA-6DD2-403E-929D-3FF20D896C5E}</guid>
80070002 <errorinfo></errorinfo> </entry> <entry> <record>2699</record> <time>2021/06/23 15:48:20.791</time> <type>Error</type> <source>VisualStudio</source> <description>End package load [AddAnyFilePackage]</description> <guid>{27DD9DEA-6DD2-403E-929D-3FF20D896C5E}</guid>
80070002 <errorinfo></errorinfo> </entry>`
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:18 (2 by maintainers)
Top GitHub Comments
This is fixed and you should use the new Add New File (64-bit) extension for VS 2022
So I’ve spent the last day or two looking at this and trying to figure out what the problem is and how to get my favourite extensions working in VS2022…
Error
The issue is somehow related to binding to
envdte.dll
when the package is loaded. Using the Fusion log viewer I’m able to see that the correctenvdte.dll
library is located inC:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\PublicAssemblies
:The failure appears to be a mismatch on CPU architecture:
Since
AddNewFile
is compiled as any CPU, and theenvdte.dll
also appears to be MSIL I’m not sure why this is.Fork
So I’ve forked the repo to https://github.com/conficient/AddAnyFile and tried out a few things. I tried just upgrading the VSSDK Build tools to preview 3 but that didn’t have any effect. I then went VS2022-only and updated the SDK to
17.0.0-previews-3
. This breaks backward compatibility with VS2019 so I modified the name in the manifest to 'Add New File VS2022` and changed the version to minimum 17.0 so it only works on VS2022.I then uninstalled the marketplace AddNewFile and ran the
.vsix
installer for AddNewFile VS2022 directly. This version installs in VS2022 and it works.You can download the working version from the Release page of my fork. I’m not pulling these changes to this repo as they break backward compatibility for VS2017/2019.