Visual Studio 2017 - Unable to add "ReportViewer" to "Windows Form" - c#

I know this question is exactly the same as this but even after following it's solution i am still stuck up with this error
error CS0234: The type or namespace name 'Reporting' does not exist in
the namespace 'Microsoft' (are you missing an assembly reference?)
Things i did to install Report Viewer
I followed the below link to install the report viewer
Download and Install Report Viewer For Visual Studio 2017 - YouTube
(this link shows how to install it from NuGet Manager and Extensions and update)
and i was able to make a Report as well as add Report Viewer to my Windows Form
but i am getting the above mentioned error on building the program
Solutions i have tried
I tried re-adding the reference by right-clicking on References folder in my project and then selecting Add Reference. and then adding Assemblies > Extensions > Microsoft.ReportViewer to the references.
I tried unloading the project and changing it's .csproj file and manually mention the version
Also cleaned the whole solution and manually removed any other remaining files in the output directory and rebuilding it.
BUT
when i try to see the designer of the form in which ReportViewer has been inserted then the Tooltip says that it is recognizing the namespace
Now, I am left with no solutions now. Any piece of advice will be appreciated.

Maybe you should try to use NuGet Package for install Reporting Service on your Winform application.
I use this NuGet and it's working fine for me.
Microsoft.ReportingServices.ReportViewerControl.Winforms

The answer was to change my .Net Framework from 4.0 Client Framework to 4.0. I guess it needs full features of that framework rather than the client version for it.

Related

Can't access namespaces from Nuget Package

I have an Identity Server 3 Project where I need to install a couple of custom Nuget Packages, that comes from a private Nuget Package repository in my company. This Nuget is installed and running in many other web projects so it is most likely not the problem.
When I install the package on Identity Server Project, logs say everything was fine and the package was successfully installed. It is listed on Project References. But when I try to access it anywhere on Identity Server Project, it just isn't accessible. I can't set up an using reference, neither call any methods by using it's full namespace (InstalledNuget.Services.Example). Visual Studio's intellisense returns "The type or namespace name does not exist in namespace 'company' (are you missing an assembly reference?)".
While investigating the issue, I found out that it is listed on Project References, but not on Object Browser.
I tried:
reinstalling the package;
restarting Visual Studio;
Deleting the packages folder and let the program restore then again;
I have been to several posts here and other websites but did not find a problem matches this one. Any hints?
The error was some visual bug on Visual Studio. I accidentally clicked on run, and it run successfully, with errors still on the screen. It ignored then completely.
Then I manually removed "bin" and "obj" folders and everything returned to normal.

ApplicationInsight does not exist in the namespace Microsoft

I've been working my way through video training series on Microsoft's Virtual Academy. The series I'm watching is titled "Windows 10 Development for Absolute Beginners" I'm at the penultimate video when I ran into a problem. Bob Tabor put the following into the constructor of the App class (in App.xaml.cs):
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
Microsoft.ApplicationInsights.WindowsCollectors.Session);
However, this line doesn't work at all for me. I'm getting red squiggly lines under Microsoft.ApplicationInsights. And when I compile I get the following error message:
The type or namespace name 'ApplicationInsights' does not exist in the
namespace 'Microsoft' (are you missing an assembly reference?)
I have tried to add a reference to that, but it didn't work. In fact VS 2017 told me outright that it was impossible to add the reference I'd found.
I'm thinking that the problem is because I'm using VS 2017, whereas when Bob Tabor did the videos he was using VS 2015. Something has changed in the configuration, but I don't understand what. I'm sure the issue is that I need to include some sort of NuGet package. I'd be delighted to do so, only I've no idea what NuGet package to install.
I'm developing for Windows 10, using Visual Studio 2017 Community Edition.
For the "Windows 10 Development for Absolute Beginners" series videos,there is a correspondent sample here. If you opened one project you are referenced and build, you will find there are three ApplicationInsights relative Nuget packages referenced, and one ApplicationInsights.config file in the project. This should caused by when OS build is 10240, you create a new Windows 10 universal application in Visual Studio that a reference to Microsoft.ApplicationInsights is added to the references folder automatically. And after that, new builds coming without adding this package automatically.
So that if you just need the error gone you may add the same three Nuget packages:Microsoft.ApplicationInsights 1.0.0,Microsoft.ApplicationInsights.WindowsApps 1.0.0,Microsoft.ApplicationInsights.PersistenceChannel 1.0.0 manually.
But actually, Microsoft.ApplicationInsights is not supported UWP app starting 2.0.0. Currently you should not use ApplicationInsights for UWP app which may be deprecated, but use HockeyApp SDK instead.

The type or namespace name '"Namespace"' could not be found in the global namespace (are you missing an assembly reference?)

I am trying to build my project by referencing private project using VS2012, it builds successfully on local machine, but I am trying to use Visual Studio Team Services (previously Visual Studio Online, Team Foundation Service) and the build agent set up by Microsoft does not find the namespace.
Tried to re-reference by reading other posts as well checking that target framework is set on all projects to .Net Framework 4, but nothing seems to work, am I missing something ?
Ok, So I solved the issue, the Visual Studio Team Services error log said that the project was not building because the build configuration was wrong and not assigned to building process, it was set to x86 I change it to Any CPU and now it was build successfully, hope this helps to someone.
if your solution have .cs files i.e. class libraries then build that library separately by right click on it and choose option build, then add reference to the website then it will be cleared.

Can't get Microsoft.Office.Interop reference to work

I have a C# winforms app and I am simply trying to open an Excel sheet. When I try to add a reference to Microsoft.Office.Interop, the "Office" part is red and says "Can't resolve symbol 'Office'".
When I attempt to build, the error is:
The type or namespace name 'Office' does not exist in the namespace 'Microsoft'
(are you missing an assembly reference?)
I have Office 2012 installed, and I think I have the Primary Interop Assemblies installed... but I'm not positive.
I know that this should be so easy, but I've been looking around for an answer to this for almost an hour and just can't figure it out. Thanks in advance!
Use NuGet Package Manager in VS2015
Right click references in your visual studio project
Select Manage NuGet Packages
Type microsoft.office in the search box
Select Microsoft.Office.Interop.Excel
Click Install
Rebuild your solution
You need to add the library assembly reference to your project.
They are referred to as "Primary Interop Assemblies".
(Assuming Visual Studio 2010)
Procedure
open the solution explorer window
expand your project folder accordion.
right click on the references element
select "add reference" from the dropdown
select the .NET tab and look for the object library called Microsoft.Office.Interop.Excel.
click ok
The object library should now appear in your references.
I had the same error this morning, with a Winforms app which had always built perfectly in the past. All that had changed was that our company had upgraded our laptops from Excel 2007 to Excel 2013.
After some investigating, I realised that the app was a .Net 3.5 app, and although the Solution Explorer suggested that all the refererences were fine..
...actually, they weren't. The tell-tail sign was that, when I tried to re-add the References in the app, they couldn't be found...
What I needed to do was:
update the app from .Net 3.5 to .Net 4.5
remove the Office-related References (the first 5 shown in my first
screenshot above)
re-add the References (now shown as version 14 or 15)
I also had to change one line of code from:
excel = new Excel.ApplicationClass();
to
excel = new Excel.Application();
Once I'd done this, the app built without errors, and ran successfully again.
Easier way to add this package in VS 2015:
on the line code using the package press "Alt+Enter" then select "Find this namespace on nuget.org"
Install it and enjoy :)
I think you are missing the dll reference. Add Microsoft.Office.Interop.Excel.dll to project reference and then try.
You need to install Office 2013 to clean this build error.

Add FreeImage .NET to solution

I have followed the posts on this, but i am still not getting a few steps. I am new to C#, and that is probably the issue. I would love a little help (I have been banging on this all day).
I can open the FreeImage.NET solution (Win7 64 bit machine btw) in Visual Studio. This post says i need to Build it to get the C# dll. When i build it, i get hundreds of errors "type or namespace 'Name' could not be found".
Does it need the C++ DDL added first? I dragged and dropped it onto the solution, but still the errors.
Am i doing something simple and wrong?
Specifically what i am trying to do is add FreeImage to project in C# Visual Studio Express 2012.
Thanks,
Dan
After downloading the version of FreeImage.NET , I opened the following VS2005 Solution File in VS2012.(Thats the only one I have)
FreeImage3154\FreeImage\Wrapper\FreeImage.NET\cs\FreeImage.NET.2005.sln
After upgrading the project and building it for the first time, I saw around 491 errors. If you open the references of the UnitTest.2005 project, you will see that the nunit.framework assembly is missing. If you have nuget installed , in VS2012 you can
Right Click references > Manage NuGet Packages > Search for NUnit and install it.
In the image below we see that the nunit.framework assembly is correctly linked.
After doing this there were only 50 errors remaining and they were all because the Xml Documentation file checks were enabled. You can disable this check as shown below in the Library.2005 project.
Build again, and it should succeed.
NOTE: The FreeImage website provides only a 32-bit version of the DLL, thus to use this DLL you will have to ensure that you set your project version to 32-bit. To obtain a 64-bit version of the FreeImage DLL you will have o download their source code project and manually do a 64-bit build as show in this blog.

Categories

Resources