I cannot access the Excel interop from my VB program - vb.net

I have had to replace my laptop. One of the applications I have needed to install is Visual Studio Community 2019 since I rely on some programs which I wrote in VB. My memory of the 2015 version is that I just installed it. With the 2019 version, I must specify which components I need. Given how many components are available, I can see why they cannot install everything. I need access the Excel interop and have downloaded every component that might give access to the interop without any apparent success. The statement Imports Excel = Microsoft.Office.Interop.Excel gives the error “{) Namespace Microsoft. Namespace or type specified in the Imports ‘Microsoft.Office.Interop.Excel’ does not contain any public member or cannot be found.”
Searching for help, I found: “to use the features of a Microsoft Office application from an Office project, you must use the primary interop assembly (PIA) for the application.” For my 64-bit computer, these should, apparently, be installed in “%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA\”.
I find that folder “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA\” contains subfolders “Office14” and “Office15”. Each of these subfolders contains a different set of PIAs. Both contain “Microsoft.Office.Interop.Excel.dll” with the Office 14 version dated 31Mar2015 and the Office 15 version dated 7Oct2015.
I use Office version 15. Should I move the PIAs I want from folder “PIA\Office15” to folder “PIA” or have I misunderstood something else?

You can try to install the Nuget package Microsoft.Office.Interop.Excel form Nuget Package Manager.
First, right click the project and select Manage NuGet Packages....
Then type Microsoft.Office.Interop.Excel in the search bar and install it:

Kyle Wang’s answer allowed me to solve my problem. However, his images and descriptions differed from my experience with Visual Studio 2019. I suspect he uses an earlier version. This answer documents my experience with Visual Studio Community 2019 in the hope that other can benefit from my troubles.
With Visual Studio 2015, the version I have been using, only Visual Studio is installed. With Visual Studio 2019, Visual Studio Installer is also installed.
If I open Visual Studio Installer I see:
If I click Modify, I see:
If I scroll down a little I see:
The blue ticks in the righthand corner identify the workloads I have already installed.
If I click Individual Components, I see:
I am unsure which components were downloaded because they were included in a selected workload and which were downloaded because I selected every component that might include the Excel InterOp I was looking for. I will probably uninstall Visual Studio and re-install now I know what I need.
If I scroll down enough, I see:
I definitely needed to download NuGet package manager if I want access to the Excel InterOp. I do not know if I needed NuGet targets and build tasks. If I re-install Visual Studio I will try without NuGet targets and build tasks and update this answer to report if it is needed. I have not found any documentation describing the significance of these components, so it seems you need to experiment to determine what components you need.
Once you have selected the workloads and or individual components you want, click Modify in the bottom righthand corner. A progress screen is displayed while the installation is performed. When it has finished, close Visual Studio Installer.
Open Visual Studio 2019 and then create or open the solution that requires the Excel InterOp. The fourth tab in the top row is Project. Click it. The bottom but one line in the dropdown menu is Manage NuGet Packages…. Click it. You will see:
Click Browse to get:
https://www.nuget.org/ claims they hold 2,031,503 versions of 181,450 unique packages. As far as I can tell, they are displayed in order of download numbers. For example, Newtonsoft.Json has been downloaded 320.5 million times. To find any particular package you must use search. Searching for “microsoft.office.interop” reduces the list to something manageable with the Excel Interop at the top. Select the package you need and click Install on the right.

Related

Visual Studio 2015 - a lot of Packages are missing

So I recently bought a new computer. And now I wanted to install visual studio 2015. So I did. But now the problem is that i cant create a new project because i cant select a vb.net form or anything else and also im getting these error messages saying:
The 'ErrorListPackage' package did not load correctly
The'VisualStudioPackage' package did not load correctly
The Microsoft.visual studio package did not load correctly
anyone has a solution for this? because I'm kinda getting a bit frustrated now.
I tried a complete uninstall and install and it didnt work. I tried copying folders from my laptop to my new pc but also that didn't work. Also switching frameworks doesn't do anything. I also never experienced this problem before but can this problem occure because I have 2 drives?? Seems odd but I think I'm also going to do an uninstall again and then try the .iso installer and see if that helps.
So this is how I fixed it for myself.
I removed all files and folders that are linked to visual studio
C:\Program Files\Microsoft Visual Studio 12.0
C:\Program Files (x86)\Microsoft Visual Studio 12.0
C:\Program Files (x86)\Microsoft Visual Studio 14.0
C:\Users\name\AppData\Roaming\Microsoft\VisualStudio
C:\Users\name\AppData\Local\Microsoft\VisualStudio
C:\Users\name\AppData\Local\Microsoft\VisualStudio Services
C:\Users\name\AppData\Local\Microsoft\VSCommon
C:\Users\name\AppData\Local\Microsoft\VsGraphics
After I deleted all of those folders I deleted the regkeys located:
HKLM > SOFTWARE > Microsoft > Visual Studio
After that I started the visual studio installer with admin rights.
And now I can create a project :)
This usually indicates an issue with an extension which ships with some dependent assemblies which Visual Studio itself (or another extension) also depends on. When these dependencies are different versions, it's not predictable which version will load.
To solve your problem, first disable your extensions and add-ins, then close Visual Studio, clear the ComponentModelCache folder under:
C:\Users\{username}\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache
And start Visual Studio again.
This should clear the immediate issue.
Now enable each extension one-by-one restarting Visual Studio every time to see if the issues come back.
To dive deeper into the underlying issue, you could look into all the extensions under these folders:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions
C:\Users\{user}\AppData\Local\Microsoft\VisualStudio\12.0\Extensions
Look for assemblies from Microsoft itself (commonly found are Microsoft.TeamFoundation.* and Microsoft.VisualStudio. in folders containing an extension that did not originate from Microsoft. These extensions are common culprits for these issues.
If you want to dig deeper, consider using fuslogvw from the Windows SDK to see which assemblies are loaded and which exact versions they are. You can also look into the Visual Studio logs after the issue surfaces to see what underlying cause there may be. The log should be available under:
%AppData%\Microsoft\VisualStudio\14.0\ActivityLog.XML

Visual Studio 2013 is not remembering references added in the solution explorer

As mentioned in the title I am having an issue with a Visual Studio Project.
I have decided to use Visual Studio 2013 (latest version through dream spark) to code with Unity 3D (also the latest version) as I am having issues with MonoDevelop crashing and I use Visual Studio for other stuff anyway so it is convenient.
I have to use an external dll for my Unity game and I find every time I start a new session the dll file is gone in the references tab in the Solution Explorer (in Visual Studio) and I have to re-add it manually. Is there some sort of global references list I can add this to to prevent that issue? I've had a look and can't find anything but I also don't know what I am looking for.

How to use ReportViewer 2012 in Visual Studio 2013 (WinForms/Wpf)

I would like to upgrade a project which uses RDLC to create reports. The solution uses Report Viewer 2010SP1.
I installed successfully the report viewer 2012 runtime, however the component does not appear in the add references windows of visual studio.
I also checked the NuGet-Packages and there I found a “Report Viewer”-package 11, but while installing this version, only the web-component but not the WinForms-component has been installed.
On the web I have seen some workarounds changing the registry, but is it really necessary to manually change the registry to have this done?
One way, probably not the best, is selecting the component directly with the "browse"-option.
In the “Add Reference” dialog, browse to “\Program Files (x86)\Microsoft Visual Studio 12.0\ReportViewer” and select there the component "Microsoft.ReportViewer.WinForms.dll"

Add VB.NET to Visual Studio 2010 Professional

In the past I have only used Visual Studio 2010 Professional for C#, but now I need to work on a little bit of Visual Basic. When I go to create a project it only shows C# project templates. I am assuming when I installed Visual Studio 2010, I only installed C#.
How do I now install VB.NET support?
I tried following a MS tutorial: I went to Control Panel and selected Change/Uninstall on Visual Studio, but then it asked me to insert a CD, of which I have none since it was donwloaded.
Nevermind I figured it out. (win7) Control Panel -> Programs and Features -> Uninstall/Change on Visual Studio -> then when you hit the Add/Remove features and you get the popup asking about the cd (which is where I assumed i was stuck before) if you hit Download it takes you to the dialog where you choose additional languages to install and it worked.
I apologize for my earlier flippant comment, and offer you
http://download.cnet.com/Microsoft-Visual-Studio-2010-Professional/3000-2212_4-10618634.html
I had same problem but i did the simplest solution ,since i had my .iso(visual studio express) file i had downloaded I used my winrar to extract files ,went to VBExpress ,open the folder and click on the setup and it all worked out successfully...

the application requires that assembly microsoft.reportviewer.processingObjectModel version 11.0.0.0 be installed in the global assembly cache first

I have a small windows forms application created in Visual Studio 2012 that uses ReportViewer version 11.0.0.0.
The application target framework is .NET 4.0 and its deployment method is ClickOnce
On my PC it installs but on client machines, intallation fails with error
the application requires that assembly microsoft.reportviewer.processingObjectModel version 11.0.0.0 be installed in the global assembly cache first.
On the client machines, i have installed
.NET 4.0
ReportViewer 2010
Microsoft Report Viewer 2012 Runtime CTP
SQLSYSCLRTYPES.msi
in the project application files settings, i have set microsoft.reportviewer.processingObjectModel publish status to Include(Auto), in the references i have also set its Copy Local property to True.
what am i missing?
I have even followed the instructions here http://msdn.microsoft.com/en-us/library/ms251723.aspx
Here is (arguably) the best way to deal with this issue... without downloading or installing any extras. This worked with Visual Studio 2012 (Ultimate)
Goto the main project within your solution(default/statup project)
Right Click and Click Properties / Select "Your Project">> Project>> Properties
Click on "Publish" Tab to see publishing options
Goto "Install Mode and Settings">> Click "Application Files" and Dialog opens
Go down and look for the items set with "Publish Status" > Prerequisite
You will find ReportViewer and Several Other Files set to Prerequisite
Change all the Publish Statuses to "Include" in the drop down
I know you only need the ReportViewer Only but this will eliminate other potential problems I came across
Now all the required files will be added to your installation setup good to go!
For interest, you can change include a desktop icon under "Install Mode and Settings">>Options>Mainfests>Create Desktop Short Cut
you are missing the ProcessingObjectModel.dll file find the version 11.0.0.0 in gac assembly C:\windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel and add it to bin dir.
We had the same issue, but the thing is, its automatically adding it to the references (microsoft.reportviewer.processingObjectModel), if u EXCLUDE it from the publishing properties(properties->publish->application files), It might fix it.
A better option would be to install the Microsoft Report Viewer 2010 SP1 Redistributable Package at:
http://www.microsoft.com/en-us/download/details.aspx?id=6610
Your users will need to have this package installed as well. If you just copy and paste a MS DLL, you'll have to redeploy it every time you upgrade your application.
If you are using WinForms, to me it seems pointless to worry about installing this DLL in the GAC when it's being used for a report viewer that is deployed via click-once. This isn't a big file and you're probably using it as a report viewer control on a form, nothing more. One possible solution is to do the following:
In Visual Studio, go to the reference in your project for the assembly Microsoft.ReportViewer.ProcessingObjectModeland locate the file path to the folder for that assembly. Mine was version 12 and so my file path was C:\windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\12.0.0.0__89845dcd8080cc91
Copy the file path of the folder the assembly is in and remove the reference from your project (right click the reference and select "Remove").
Win + R to get a 'Run' prompt. Paste that folder path in there and execute to jump right into the folder of that DLL.
Find the DLL, it should be the only file in that folder, and copy it to your Visual Studio project folder. You shouldn't care about 100kb of extra space on your drive consumed, and I don't think this DLL is one you'll need to update.
Back in Visual Studio, right click References, Add Reference, and browse for that DLL in your project folder. After adding the reference, make sure that the Copy Local property is set to true.
Clean and rebuild, test the application on your local computer, than Deploy your ClickOnce again.
Now when users install your application with ClickOnce, the reference will not refer to the GAC at all and there won't be any need to rely on the prerequisite check/installation process for this DLL because you have included it directly in your published application.
It depends on the setup type you are using but basically, it means the required library is missing from your server or computer. To enable the application to download from the server (In a client-server architecture), you need to include the file(s) in the project.
Go to your application option and locate the "Publish" tab
Click on "Application files"
In the ensuing dialog, select to include all the libraries you want included (or that are required to run your application on the client machine and click "Ok")
Build your application and then publish to the server.
I hope this works for you, it worked for me in Visual Studio 2010 Professional
In case of Windows 10 it won't work installing Microsoft Report Viewer 2010 SP1 as describe by user1236560. First you need to install Prerequisites for SQL Server Management Objects (SQLSysClrTypes.msi) need to choose between x86 and x64 depending on your hardware. You could find it on: http://origin.www.ms.akadns.net/downloads/en/details.aspx?FamilyID=16BC778C-357B-46E9-8356-D575903AC831
After that you need to install MICROSOFT® REPORT VIEWER 2012 RUNTIME that you could find on: https://www.microsoft.com/en-us/download/details.aspx?id=35747
Both of this package will have to be installed.
I encountered this error
System Update Required
Unable to install or run the application. The application requires that assembly
Microsoft.ReportViewer.ProcessingObjectModel Version 11.0.0.0 be installed in the Global Assembly Cache (GAC) first.
Please contact your system administrator.
this error popped out when installing an application made from Visual Studio
meaning I am one of the client
I have Visual Studio 2015 and a Microsoft SQL Server 2014 and didn't know about Crystal Reports and other related stuff to it. I do check the version of my .NET Framework which is version 4.6.2.
I have several extension files and distributable files downloaded and yet doesn't solve my problem.
I do not know if I solve the problem generally but I do become successful in installing the application
so I downloaded and installed the ff:
SAP Crystal Report for Visual Studio 2015(latest, just to make sure)
Microsoft System CLR Types for Microsoft SQL Server 2012
Microsoft Report Viewer 2012 Runtime.
the problem took me about 2 days to trouble shoot, Be careful on downloading and installing extension files and distributed files cause it will munch some space too.
The Best answer is:
Here is (arguably) the best way to deal with this issue... without downloading or installing any extras. This worked with Visual Studio 2012 (Ultimate)
Go to the main project within your solution(default/statup project)
Right Click and Click Properties / Select "Your Project">> Project>> Properties
Click on "Publish" Tab to see publishing options
Go to "Install Mode and Settings">> Click "Application Files" and Dialog opens
Go down and look for the items set with "Publish Status" > Prerequisite
You will find ReportViewer and Several Other Files set to Prerequisite
Change all the Publish Statuses to "Include" in the drop down.
I know you only need the ReportViewer Only but this will eliminate other potential problems I came across
Now all the required files will be added to your installation setup good to go!
For interest, you can change include a desktop icon under "Install Mode and Settings">>Options>Mainfests>Create Desktop Short Cut
It reduced all of my head aches.