Myself as well as my coworkers all started seeing this problem sometime in the last few weeks:
Build FAILED
CSC : warning CS8032: An instance of analyzer My.Company.Generators.ReportingV2Generator cannot be created from /Users/work/dev/git/reporting-model/src/My.Company.Generators/bin/Debug/netstandard2.1/My.Company.Generators.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/Users/work/dev/git/reporting-model/src/My.Team.Models.ReportingV2/My.Team.Models.ReportingV2.csproj]
/Users/work/dev/git/reporting-model/src/My.Company.Api/SmokeTests/Tests/ContentAskExpertSmokeTest.cs(7,20): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'My.Team' (are you missing an assembly reference?) [/Users/work/dev/git/reporting-model/src/My.Company.Api/My.Company.Api.csproj]
...
Many more of the above "type or namespace" errors
...
This happens on both macOS and Windows. It works on Linux (both on a personal machine and inside mcr.microsoft.com/dotnet/sdk:5.0.
Literally none of the source generator code / csproj has changed, it started spontaneously around two weeks ago. I can reproduce this on a commit from two months ago too, so it seems like something might have changed externally in the packages?
I found the solution for this by going to Microsoft directly.
The error on the failure case is that the generator is dependent on Microsoft.CodeAnalysis.dll version 3.10, and 3.10 only shipped in 5.0.300. It appears that your success case is using SDK 5.0.300 but the failure case is using 5.0.204.
You have two options to fix this:
If you're not using any of the features introduced in 3.10 for source generators, you can lower the Microsoft.CodeAnalysis nuget package target to 3.9
Ensure that all builds are using at least 5.0.300 version of the SDK
https://github.com/dotnet/roslyn/issues/54710
Related
I am getting this error while trying to build a solution:
Error CS0246
The type or namespace name 'ClassName' could not be found (are you missing a using directive or an assembly reference?)
The error and the red lines disappear when I open the error list and click on it. I can see the missing dll file is recognized by that class and it is also listed in the references.
I searched many questions here but none of them worked for me. Here is a list of things I tried so far that might help to understand the problem.
I've got the project from TFS and have been never able to build so far. I think the project is not correctly checked in.
I choose 'build only' in the Error list section, after that the errors did not disappear.
All project versions are .Net 4.6, none of them is Client Profile like other in questions here.
I tried to clean, to rebuild, deleting references and adding them again, but none of them worked.
I have changed build output to Diagnostic then inspected errors.
I have found this line and changed all projects target version from 4.6 to 4.6.2 and it worked.
Dll could not be resolved because it was built against the
".NETFramework,Version=v4.6.2" framework. This is a higher version
than the currently targeted framework ".NETFramework,Version=v4.6".
I'm using Visual Studio 2013, and I'm getting an error in my C# code that I can't figure out. I'm working with the Microsoft Kinect SDK, but I'll keep it general.
I downloaded the SDK, and I can get the included sample programs to build and run. But when I try to use the code in my own project, I get the
Type or namespace name 'Kinect' does not exist in the namespace 'Microsoft' (Are you missing an assembly reference)
error.
The thing is, I'm not missing an assembly or reference. I have it added to the project's references, and the path is valid. Also, the using statements at the top of the file will autocomplete to "Kinect" for me. If I start typing using Microsoft., Kinect will appear as an autocomplete option.
What are the steps to debugging an error such as this? Could it be a 32/64 bit issue? I tried using Dependency Walker to look at the Kinect DLL, and while it throws some errors (Error: Modules with different CPU types were found.), it doesn't show any issues that I don't see with other DLLs that I'm using successfully.
What are some other potential issues that might cause a problem with DLLs not being recognized?
1 - Try going to your project settings and verify the version of the .NET framework it uses.
The best to do is to choose the same version as the external libraries.
If it's a client profile, it will very often bring that exact problem. (I'm not sure what the client profile is, but I ended up never using it...)
2 - Check if any of your references got an exclamation mark.
I encounter this kind of error when I debug a project
I already have EntityFramework.dll, System.Core.dll, System.Data.Entity but still Core is not referenced.
Can someone help me?
I'm having error in this Line
using System.Data.Entity.Core.Objects;
This is the error:
The type or namespace name 'Core' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
Enrique, I had this problem crop up when I started opening a project on my desktop that I had normally been opening on my VM. Masoud's answer is not helpful... I don't think he read your original post.
What I did to clear this compile error up was to open NuGet package manager and install the update that was available for EntityFramework. I had version 6.1.1 installed in the project and I upgraded to 6.1.3. I should not have had the error to start with, but upgrading the version appeared to jiggle whatever it was loose because I started compiling fine after that.
Sometimes, when you add references from other sources than nuget manager (example: Local source) you need to verify the HintPath of that reference before moving your application in another environment
I have a strange issue with my generated serialization .dll. The .dll is successfully generated I can reference it in my project, all the types are contained within the namespace Microsoft.Xml.Serialization.GeneratedAssembly as expected, even the intellisense is picking up the types and namespaces. But when I go to build the project referencing any of the types within the generated assembly I get an error along the lines of:
Error 2 The type or namespace name 'Xml' does not exist in the
namespace 'Microsoft' (are you missing an assembly reference?)
Rather odd, no? The namespace clearly exists as far as intellisense is concerned and I've never had an issue like this before. I tried to regenerate the assembly, still the same problem.
For now I have run sgen.exe with the flag /keep and just copied the generated source into my project which is fine. I was just curious if there was a way to fix this issue or if anyone else has ever come across it before.
EDIT:
It turns out that the issue is because the generated assembly is targeting a version of the .NET framework greater than the assembly that is referencing it. Now the question becomes - how do I generate a serialization assembly with Sgen that targets a specific .NET framework version.
Ok so after reading the answer on this question I managed to generate a serialization assembly that has the correct "runtime version" for .NET 3.5 and everything works as expected, sorry for wasting time.
I'm trying to build an application in C# that parses (using ANTLR) a C source file and returns me an AST with all the functions and stuff.
I did what was explained here : http://www.antlr.org/wiki/pages/viewpage.action?pageId=557075#
But after doing all that when I try and compile I get the following errors:
The type or namespace name 'GrammarRuleAttribute' could not be found (are you missing a using directive or an assembly reference?)
I have antlr-3.4 and antlrworks-1.4.3.jar
I've used the dll that are in the \antlr-3.4\runtime\CSharp2\dist\DOT-NET-runtime-3.1.3.zip and just noticed now that they are supposed to be for ANTLR 3.1.3
What could cause my problem, I must say I'm a bit lost so many versions
i had the same problem. using the runtime libs provided here and CSharp3 target with antlr 3.4 worked for me. the problem is that the runtime libs comming with antlr-3.4 for CSharp2 target are out of date. i did not try, but maybe building the runtime libs from source is another option that could help.