Missing Assembly CS0234 WebJobs, CS0246 QueueTriggerAttributes when publishing Azure Webjob - c#

After creating a new WebApp (WebJob) in Visual Studio 2015, I recently ran into an error, when I tried to publish the WebApp as WebJob to Azure, using the WebJob Publisher in Visual Studio.
The output always displayed the Errors:
CS0234: The type or namespace name 'WebJobs' does not exist in the namespace 'Microsoft.Azure'
CS0246: The type or namespace name 'QueueTriggerAttribute' could not be found
CS0246: The type or namespace name 'QueueTrigger' could not be found
I tried reinstalling and referencing the most current NuGet Packages which didn't result in success.
Finally, I found out, that my issues were solved using the Packages Version:
Microsoft.Azure.WebJobs v2.0.0
And Microsoft.Azure.WebJobs.Core v2.0.0
instead of the most current versions 2.1.0 at this point.
Perhaps you have an Idea if there could be any other Issues with this? Anyway, if you run into the same problem, the solution above helped me, but didn't satisfy me.

I tried reinstalling and referencing the most current NuGet Packages which didn't result in success.
Perhaps you have an Idea if there could be any other Issues with this?
I think your issue is more related with Visual Studio Version.
If I run the web job in VS 2015, I get the same result as you. We could see the default .NET Framework version just 4.5.1. The packages all old version. And this platform can not load the latest package correctly. It is not like VS 2017, it can not support the latest feature.
If I run the web job in VS 2017, every thing works fine. And we could load the latest package in VS 2017 correctly. If you really want to use the latest feature, you could download VS 2017 from this link.

Related

Downgrading .NET Framework causing packages issues

I am working on a project on TFS. This project was created on someone else's PC on VS 2017 and the newest .NET framework and published to Azure.
I got the project on my PC, I have VS 2015 and I had to change the .NET framework of the project to 4.6. Everything was fine, I could make changes to the project and commit.
But when I tried to publish to Azure from my PC, I got a very unclear error:
Publish Failed
Connecting to ...
Looking for solutions online, I had to downgrade the version of the package Microsoft.Net.Compilers from 2.6.1 to 2.4.0 . And that worked !
I turned off my PC. Next day when I opened the project and ran it, I got this error locally :
Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.6.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I tried to uninstall Microsoft.ApplicationInsights and reinstall it with version 2.6.1 , but it says i need a newer version of nuget.
I am not sure how to proceed from here. I already installed all the updates in my Tools -> Extensions -> Updates but nothing changed.
Why are all these things happening to my project and how can i fix it?
PS: upgrading my VS to 2017 is currently not an option due to many exterior reasons.
Thank you.
I've gotten that error locally as well and was actually able to resolve by manually adding the file to my project folder, may be worth a shot.
Downgrading .NET Framework causing packages issues
Just like Hans said nuget packages change quite rapidly, which often require the latest version NuGet. Some new features in the package only supported by the newer NuGet (like PackageReference) or some issues fixed on the newer version. For example, install package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 on Visual Studio 2015, which requires NuGet client version '3.6.0' or above.
So, the workaround for this issue is create a new project with Visual Studio 2015, copy the code from previous projects, then add those nuget package one by one to find out the reason why it needs the newer version nuget.
However, I want to talk more over about this question is that the best way to resolve this issue is to install Visual Studio 2017 alongside Visual Studio 2015. As we known, using a lower version of the Visual Studio and .net framework to open a higher version of the Visual Studio and .net framework is not recommended, it will always bring a lot of incompatibility errors and some other weird issues. Since upgrade your Visual Studio to 2017 is currently not an option due to many exterior reasons, so I suggest that you can install Visual Studio 2017 alongside Visual Studio 2015. Besides, developing the same project with different versions of Visual Studio and submitting it to the TFS server may bring many unpredictable risks.
Hope this helps.

Firebird Client - The type or namespace name 'FirebirdSql' could not be found using FirebirdSql.Data.FirebirdClient;

I've been using the Firebird client since 1.5 and I'm now on 2.6 in my
Visual Studio 2010 project with .Net 4.0
In my VS2010 Project I removed the reference FirebirdSql.Data.FirebirdClient.dll v2.6
I've installed the Firebird client 5.12.1.0 and then added the FirebirdSql.Data.FirebirdClient.dll v5.12.1.0 to the solution.
When trying to build the project I now get and error
The type or namespace name 'FirebirdSql' could not be found (are you
missing a using directive or an assembly reference?)
on every
using FirebirdSql.Data.FirebirdClient;
I've restarted the Visual Studio and still get errors.
I can uninstall FirebirdSql.Data.FirebirdClient 5.12.1 and reinstall
FirebirdSql.Data.FirebirdClient 2.6 and (remove old reference and add new reference) the project compiles.
Any ideas why?
The reason why you cannot use the FirebirdClient 5.12.1 most likely is because your .NET-Version of 4.0 is not compatible. When trying to use the newest FirebirdClient you should also get a warning, stating that it was build with .NET-Version 4.5.2 and that you need to change the framework version of your project.
So, either install a newer .NET-Framework (4.5.2 or up) or continue to use the older FirebirdClient version 2.6.
EDIT: I found a better solution on Firebirds website: Use the NuGet-Package, install it by typing Install-Package FirebirdSql.Data.FirebirdClient into the packet-manager console and it will choose the correct package for you.
However, as stated in the comments, you'd need at least NuGet client version 3.6, which doesn't support Visual Studio 2010.

Visual Studio 2017 Enterprise Add Unit Test project throws Package Installation Error

I have a solution with projects pointing to .Net Framework 4.5 which I have opened in Visual Studio 2017 and tried to Unit Test Project pointing to .Net Framework 4.5. I am getting the following error
Package Installation error .
Could not add all required packages to the project. The following packages failed to install from 'C:\Program Files(x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\502SXCIF.E5I\Packages':
MSTest.TestFramework.1.1.11: Failed to add reference to 'Microsoft.VisualStudio.TestPlatform.TestFramework'
I have tried changing the Platform to x86 as suggested on some online resources.
I am using a Windows 7 Enterprise 64 bit. Has anyone been able to resolve this.
MsUnit test related template got missed in your local system.if you have another version please try to copy respective folder it will resolve the issue.

The type or namespace name 'FriendlyUrls' does not exist in the namespace 'Microsoft.AspNet'

I have a simple WebForms project on VisualStudio 2013 created with standard web project wizard. Recently, I ve installed VisualStudio 2015 and decided to upgrade. After upgrade, I ve run standard NuGet package restore, which went just fine.
To my surprise the project does not build. Error message is:
The type or namespace name 'FriendlyUrls' does not exist in the
namespace 'Microsoft.AspNet'
I ve looked into references section: Yes, proper reference is really missing there.
I ve looked into installed NuGet packages: Yes, proper package is installed in place and updated to the latest version.
I ve explicitly uninstalled the package with NuGet and installed it again: No change. Error is still the same.
In fact, I can build project successfully with 'FriendlyUrls' uninstalled. But, of course, proper functionality is missing then. Maybe somebody may have more ideas what can be done in this situation to fix the project?
I had a very similar problem some time ago, the project wont compile and packages aren't really restored.
That's because the nuget management system changed on VS2015 from MS-build restore to Automatic Package restore.
You can use the package console to install it, but is better to follow these instructions provided by nuget: Migrating to automatic restore.

The type or namespace MongoServer could not be found

Referencing this Azure Tutorial, https://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-store-data-mongodb-vm/, released three months ago and already apparently out of date.
I followed the instructions, copied the code but am unable to build the application with this error: CS0246 the type or namespace MongoServer could not be found Dal.cs line 13.
Azure support responds "If a type or namespace is not available, it’s generally because of a missing assembly or DLL.". Agreed, but there is no missing assembly or dll. I suspect the API has changed but can find no documentation in support of this suspicion. I am therefore unable to resolve the issue.
I've included a screenshot showing the relevant assembly is installed.
I originally suspected the MongoDb.driver API had changed. The example uses version 2.0.1 and I had installed the latest, 2.2.4. However, after uninstalling the latest version and installing version 2.0.1 I get three errors, the original plus two others. I'm left wondering, how was this code originally built?
I learned through the MSDN Forums that I need to use the MongoDb.Driver.Legacy version, which can be installed through the Nuget Management Console with this command:
Install-Package mongocsharpdriver
The project now builds without error.
This is because you have installed an older version.
Please go to Nuget Package console manager and reinstall the Mongocsharp Driver.
Install-Package mongocsharpdriver
After installing build the solution.
Just update the class to MongoClient and it is solved :)
http://mongodb.github.io/mongo-csharp-driver/2.3/getting_started/quick_tour/

Categories

Resources