VSIX with IWizard extension debug code out of sync - visual-studio-extensions

I am trying to figure out how my VSIX project stopped working [VS2022]. following this article, I was able to run and debug my VSIX project with an IWizard implementation. Something changed, I'm not sure what. I can F5-run and everything works but the code executing is not the latest code and I'm unable to hit any breakpoints (VS says No Symbols have been loaded for this document). I can tell its not the latest code because of the debug console messages and the UI is an older version.
I've tried a number of things including
Clean install
Made sure I'm in debug
Removed the extension from VS, and just tried running debug from VS
Verified compiled output is in AppData\Local\Microsoft\VisualStudio\17.0_c281014fExp\Extensions\ {myextension}
Property settings are set
Assets have not changed
I did mess around adding additional install targets but I don't think this caused any issues
Any ideas how the the project can be out of sync with the code?
I could go back to the start and implement a new project but hoping someone out there can help resolve this issue. Appreciate the help.

I figured this out. I don't know why it works the way it does, but this definitely fixed the problem.
I removed ALL extensions from VS using the extensions manager interface. So, all old instances are gone (but are they?)
In my VSIXProject I would do a clean solution, rebuild, run. I verified that the latest DLL's were being output to
C:\Users{user}\AppData\Local\Microsoft\VisualStudio\17.0_c281014fExp\Extensions{username}\Acme Project Template\1.0\VSIProject1.dll - VS Build output went here
In the debugger, when my little windows form loaded, I could tell it was old code and caught the reference in the output windows that it was loading an older version of the package.
C:\Users{user}\AppData\Local\Microsoft\VisualStudio\17.0_c281014fExp\Extensions{username}\Multi Project Name\1.0\VSIProject1.dll - debugger loaded this
C:\Users{user}\AppData\Local\Microsoft\VisualStudio\17.0_c281014fExp\Extensions{username}\Acme Project Name\1.0\VSIProject1.dll - debugger loaded this after deleting above
C:\Users{user}\AppData\Local\Microsoft\VisualStudio\17.0_c281014fExp\Extensions{username}\Acme Project Template\1.0\VSIProject1.dll - VS Build output went here
After I deleted all the previous extensions in file explorer and re-ran my project, the right code executed and debugging was enabled. IDK why the older versions were picked during debugging but it's fixed. HTH someone.

Related

Issue with upgrading project to Visual Studio 2019

I upgraded existing web forms app (c#) from Visual Studio 2017 Enterprise to 2019. While code is working fine, when I open default.aspx page - I get 123 errors (while code compiles fine). If I open it back in 2017 version - no errors
I had addressed couple of the errors but not sure what to do with the rest. Especially puzzling that code compiles with 0 errors. Errors show only if I open default.aspx
Most errors are CS0103 - the name 'name here' doesn't exist in the current context
Few errors CS0400 - the type or namespace 'project name' could not be found in the global namespace
Few CS1061 - 'default_aspx' doesn't contain definition for 'Context'...
I don't understand how it still compiles without errors and works? What changed with upgrade that those errors popped up? All those names and namespaces exist and there were no changes other than upgrade. New requirements? How to fix it?
Found a solution:
This is happening to projects that are using v1.0.0 of Microsoft.Net.Compilers. To work around this problem you need to update to the latest stable version which is 3.0.0.
All errors disappeared.
Looks like something broken with VS Intellisense since the compile and build sueeccded.
1.Before you open the web form project in VS2019, navigate to its Solution Directory and delete the hidden .vs folder there, after that open the project in VS2019 to check if it helps.
2.If the issue persists, try cleaning the VS component cache after close all VS instance:
Go C:\Users\xxx\AppData\Local\Microsoft\VisualStudio directory, you can find many 15.xx and 16.xx folders there, feel free to delete all ComponentModelCache folders in them and restart VS.

Trying to run UWP in release mode gives an "Payload contains two or more files.." error

I asked this on the Xamarin forums but got no response.
Running my app in debug mode works fine, but when I try to run in release mode, I get these errors:
Error Payload contains two or more files with the same destination path 'e_sqlite3.dll'. Source files:
C:\Users\Bob.nuget\packages\sqlitepclraw.lib.e_sqlite3.v140\1.1.8\runtimes\win10-arm\native\e_sqlite3.dll
C:\Users\Bob.nuget\packages\sqlitepclraw.lib.e_sqlite3.v140\1.1.8\runtimes\win10-x86\native\e_sqlite3.dll
I have seen other posts where some users have updated the nuget for UWP and others that have actually deleted one of the dll's, but none of these work for me; when I try to delete one of them, I then get an error that it is missing, so not sure what to do.
I have deleted my nuget folder and re-got everything fresh, cleaned my solution, rebooted, but nothing seems to work.
Well, I ended up opening an issue with Microsoft over it and turns out that I had the build target set to ARM (Project properties->Build->Platform Target) which apparently tries to copy 2 different versions. I set it to x86 and works fine.
The issue for me was that the project was set to target x64 in the project properties, but when I debug, I debugged using x86. The moment I switched to debug using x64, it worked for me.

problems setting up aspnetcore-angular2-universal example seed

We are for some time now trying to find a solution for server prerendering of SPA, specifically Angular4, for the purpose of SEO.
We have come to try and use aspnetcore-angular2-universal, which seems to be the perfect solution, however, we encounter problems deploying the published build to a local IIS server.
We have posted an issue regarding the problem on the issues page at which can be found here:
https://github.com/MarkPieszak/aspnetcore-angular2-universal/issues/491
We have followed the instruction under "Getting started" & "Deploy" (which can be found here: https://github.com/MarkPieszak/aspnetcore-angular2-universal) exactly but the error still exist.
The support is unresponsive on issues and thus we are posting also here.
The problem is (as mention in the issue linked here) that we get the following error:
Which indicates a problem with the web.config file. However the webconfig file is exactly as supplied in the starter project and seems also legit.
I should mention that building and running the project using npm build:prod and dotnet run works and we can lunch an in memory application from Visual Studio Code, however when taking the published folder to an IIS folder the error occurs.
Any help will be appreciated.
Did you installed .NET Core Windows Server Hosting bundle?
Check if AspNetCoreModule listed in IIS => Modules. Sometimes it not installed properly during #1, even if there was "Succeeded" at all steps. In that case I just removing it via Program & Features, and reinstalling it then.
Once I saw that error when manually copied web.config from sources over the publish folder. Problem is that original web.config contains placeholders like %LAUNCHER_PATH% and %LAUNCHER_ARGS%, which turns to appropriate values (dotnet and .\YourApp.dll for instance) during dotnet publish
Aperantly there were incompebilities between angular5 & universal in serverside.
The https://github.com/MarkPieszak/aspnetcore-angular2-universal seed was downgraded to using angular4.3 instead of 5. When we updated seed, the problem was solved.

Cannot load sqlite.dll with QSQLITE2 Qt plugin

I use QtCreator + mingw.
I have compiled QSQLITE2 plugin. I simply entered plugin directory in Qt source code:
c:\Qt\Qt5.2.0\5.2.0\Src\qtbase\src\plugins\sqldrivers\sqlite
and I built it with my sqlite 2.8.17 that I have locally (as dll and header):
qmake "LIBS+=-Lc:\projects\lib -lsqlite" "INCLUDEPATH+=c:\projects\include"
make
make install
Everything builds okay.
Now, I have another DLL (also implemented as Qt plugin, a custom one), which makes use of QSQLITE2 Qt plugin. My own dll is also linked to sqlite.dll. So it looks like this:
my.dll depends on sqlite.dll
%QT_PLUGINS%\qsqlite2d.dll depends on sqlite.dll
my.dll uses qsqlite2d.dll through Qt's plugin engine
myApp.exe loads my.dll
Problem is that my application cannot load my.dll, because of invalid location access or something like that. I don't know any details and that's the problem.
The sqlite.dll is in the application directory when running it.
When I run application in debug mode, it crashes in some assembly file, but in stack trace I can see that it's somewhere inside sqlite.dll, in sqlite_step symbol. That's all I know.
Note 1) I have another plugin dll, the my3.dll, which uses QSQLITE plugin (it's for sqlite3) and is linked with sqlite3.dll and this one loads just fine. I have compiled QSQLITE plugin myself as well (even there was the one provided with Qt, that's because Qt linked statically to sqlite3 and I wanted it to link dynamically to sqlite3.dll).
Note 2) Both plugins work just fine under Linux.
Any hints what might be wrong? What else can I check?
EDIT:
I've just performed a test: I deleted my.dll from plugins to avoid loading it at all. Then I added code to main.cpp:
QSqlDatabase::addDatabase("QSQLITE2", ":memory:");
Thing is, that it also crashed, with the very same stack trace (at this very line, I debugged it). Thus I think there's something wrong with sqlite2 Qt plugin, but I'm still unable to tell what. I looked up for other sqlite.dll, I just downloaded the one from sqlite.org: http://www.sqlite.org/sqlitedll-2_8_17.zip - so it's official build, but it's the exactly the same file I had and it also fails the same way.
It turned out that qsqlite2d.dll cannot be linked sqlite.dll, because sqlite.dll is not compiled in debug mode. After recompiling application in release mode (thus using qsqlite2.dll, not qsqlite2d.dll), the plugin loads correctly and works.
This makes sense, but just one more thing that bugs me - qsqlited.dll (for sqlite3) had no problem linking with sqlite3.dll. No matter if I compiled debug or release - the single sqlite3.dll worked with both debug and release plugins. Anyone has an idea how is that possible? Please comment if you do, I'd appreciate it.

'Publish failed' but build succeeded?

When using Visual Studio 2008, when I "Publish Web Site", the application builds correctly, but then I get a "Publish failed" message:
What possible reasons are there for this, and how can I prevent it?
I had the same issue. Nightmare to identify the problem, because the logs and outputs show no errors or failures. I simply get "Build: 39 succeeded" and "Publish: 1 failed".
I resolved the problem by systematically removing all NuGet packages one at a time (and removing code that references it) until I identified the offending one.
This takes a LONG time!
However, the answer for me was Microsoft.Net.Compilers.
No idea how I ended up with that in my project, but as soon as I removed that package, everything publishes fine again.
Edit - For what it's worth, this problem occurs on VS 2008, 2012 and 2015 but does not occur on 2017.
You can try this:
Perform precompilation against the web application.
Clear the target directory(virtual directory in IIS or physical file
folder) and deploy all the files (of the web application) into the target
directory.
In the output window you can check at which stage does the publish website
operation fail. For example, at the first stage, if there are some error
which will only occur at precompilation, that will cause the stage 1 fail.
Or some times if the target directory has something configured incorrectly.
Such as the IIS virtual dir is not set to the correct ASP.NET version or
some old files are locked and prevent them from being cleared. Mostly,
publish failed will be caused by IIS side configuration issue such as
authentication setting....
Source link
You can open the output window by pressing Ctrl+W, O.
Sometimes it's because you need to be running VS as Administrator to be able to write to the target directory.
Check the Output messages, they should help you solve the problem
I had to copy project to C:\a\ and than publish. I suspect problems with long path. Strange, but worked for me.
The conclusion is: Try another VS edition and see if that does it.
Here is what did it for me.
I have VS 2013 Pro and Visual Studio 2015 Community. I sort of use one or another to work on my MVC project and all was fine. Then all of the sudden VS 2013 could not publish though it would build just fine. There was no erros other than some silly ...code is not returned from all paths...
So when I open it in VS 2017 - it published the same project just fine. I am suspecting a compiling issue - because that was the stage it would fail at.
Hope that helps you save a bit of time.
Not sure if this happens in different versions of Visual Studio, but at least in 2015 Professional Edition, the problem arises when we try to update all Nuget packages from the solution using the Packages Manager.
As pointed out by #SimonGoldstone the issue is caused by the package "Microsoft.Net.Compilers". By default, the package gets added to the solution while creating a new web application. The default version 1.0.0 does not introduce any problems. I was able to keep testing with latest versions until 2.4.0 and everything works fine, but from 2.6.0 henceforth is when it all starts. If an update is strictly required, I would recommend updating the aforementioned package until version 2.4.0. After doing some research, seems that some bugs on later versions than 2.4.0 are introduced and not fixed on the long term. What is curious though, is how this problem gets included on Nuget with no basic quality control checkpoint.
There are many proposed solutions for this. I think they are overcomplicating the issue.
I found the following worked for me:
Locate the obj(Release or Debug) folder in your solution
Inside the Release or Debug folder delete the CONTENTS of the 'AspnetCompileMerge' folder
Now try and publish.
Make sure you empty the target folder (manually) before publishing. Sometimes vs cant delete a file which will result in a failed publish
After trying a Rebuild, having other Projects in my Solution able to publish correctly, and changing my publish location to the C: drive (locally attached) instead of pushing to a mapped network drive, I was still having an issue where the only error output said:
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
My solution is targeting x86, but I think during a Git Merge, this project had it's profile switched to Any CPU. After creating an x86 profile for the project and having it match the target of the publish goal and of the active solution configuration, I was able to successfully publish again.
Check Project BIn directory. there must be a DLL of your page or control. which has to be recreated during publish. So exclude it or remove it
I ran into this same problem today and it was due to the Thumbs.db file that was created when I opened my images folder to look for an image. I deleted the file and the project deployed successfully. Hope this helps someone else in the same situation.
Delete publish profile and create another one . Worked for me
In my case, I was publishing to a directory in a mapped network drive, but the Output panel/window was indicating that the location didn't exist. The path was correct, and the drive was fully accessible. The problem resolved itself when I re-set the path to publish to in Visual Studio by using the ... button.
With me it was simple - the dist folder was locked. I unlocked it by an unlocker and the publishing resumed.
I have several user controls that are registered in the web.config, and have a ClassName in the .ascx file header. For normal builds everything works fine, but with a publish those class names were not recognized anymore. At some point I found out that the errors were not in my regular code files, but in copies in a temp directory for publishing.
I had "Precompile during publishing" turned on (to be found under Settings > File Publish Options). Turning that option off worked for me.
I had the same issue with VS2017 with a website project. Build worked, but publish gave me an error:
Error CS0012: The type 'System.Net.Http.HttpMessageHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
All my projects already had a reference to System.Net.Http so it was really confusing.
To fix it, I had to copy System.Net.Http.dll into my website project / bin folder so publish could find it and copy it to my web host. I found System.Net.Http.dll by looking at another project's references (a class library), then System.Net.Http.dll Properties, and seeing the path (C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NetFramework\v4.6\System.Net.Http.dll).
i know iam late but i think it should use for someone whos searching for this query.
just uninstall all your nuget pakages , then clean and rebuilt solution ,
now click on publish , sure it works and u will see publishing starts and works correctly now
If any one had changed the version of the project file and related framework. then this type of issue happened.
please go to "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\Web" location for visual studio published and build setting -> edit -> comment the force copy of all file section.
I had one file that was not found. I had copied in a png file to replace a jpg in the content folder , same name except filetype extension.
Project built fine, but refused to build and publish . changed extension of file so it could find that file name and it worked - no errors amazing 1 thing wrong and everything else is an error.
The case for me was that Visual Studio was not signed in to Azure, but provided no indication of that. I edited the publish profile, clicked "Validate Connection" then clicked "Save" and then it worked.
I was working on a feature branch, which was failing. Switched to Master Branch, deleted the feature one and created another one. It worked.
What caused my issue was a little different, but has similarities to some of the reasons stated above.
I managed to trash my local copy of a given application and did a GIT hard reset to get the most recent from the repository in question. This in turn, wiped out the web.config file (which was not stored in the GIT repository for various reasons).
This cause configuration information for various NuGet packages to be "lost" (since it was stored in web.config).
Fortunately, I had "backed up" the web.config, so once I figured out it was not out there (a migration failed because I was unable to connect to the database), I was able to replace it.
Tried the publish again, after fixing the web.config, and everything worked perfectly.
If you are opting for the "Delete all existing files prior to publish" in the publish web dialog box, then make sure that the Visual Studio is started with Admin rights. Right click the Visual Studio and click Run as Administrator. Hope this helps.

Resources