My Blazor standalone application .Net 5.0 generates a wrong MvcApplicationPartsAssemblyInfo.cs with the following content if I add a project reference to it:
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Wur.GroupTool.Core")]
Giving the following error (note the double 'AttributeAttribute'):
Error CS0234 The type or namespace name 'ApplicationPartAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.ApplicationParts' (are you missing an assembly reference?) Wur.GroupTool.Blazor C:\Projects\FB-IT\grouptool\sources\Wur.GroupTool\Wur.GroupTool.Blazor\obj\Debug\net5.0\Wur.GroupTool.Blazor.MvcApplicationPartsAssemblyInfo.cs 14 Active
My guess is that the attribute shoule be:
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPart("Wur.GroupTool.Core")]
but since it is generated I have no clue how to handle this problem. Tried changing the code of course but on compilation it is regenerated again and hence the error again.
== EDIT ==
Just started from scratch again using this command:
dotnet --dry-run new blazorwasm -au SingleOrg --framework:net5.0
Changed the library to insert to starget net5.0. Issue stays the same. It could be a bug in the compiler. When 'Attribute' is added it should use that name but instead it adds 'Attribute' to the name resulting to 'AttributeAttribute'.
The answer here is as follows. In the Library I wanted to add some MVC libraries were present. Blazor does not like loading MVC libraries, they don't mix well. The error was misleading. But after removing all code that uses MVC from the library (which should not have been in there in the first place) the reference was accepted just fine.
Related
I renamed my project, and updated it to .Net 5. Now, I obviously havent catched all the occurances since I get this error:
\source\repos\BlazorBattles\BlazorBattles\Server\obj\Debug\net5.0\Razor\Pages\Error.cshtml.g.cs(78,71): error CS0246: The type or namespace name 'blazor_battles' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\hagenek\source\repos\BlazorBattles\BlazorBattles\Server\BlazorBattles.Server.csproj]
However, it is hard to locate it, because the error shows a file that is being generated by the project ,not a file that is in the core project.
Any tips?
For some reason visual studio could not locate the string "blazor_battles" in the Error.cshtml file inside of Server/Pages directory.
Using hyphens in your project names creates problems. Don't do it.
I build an asp net core API project with a docker. This project contains some proto files and imports some google well-known types. But I got output errors:
- google/protobuf/Timestamp.proto : error : File not found. [/src/mymy/mymy.csproj]
- Protos/notification.proto(4,1): error : Import "google/protobuf/Timestamp.proto" was not found or had errors. [/src/mymy/mymy.csproj]
- Protos/notification.proto(112,5): error : "google.protobuf.Timestamp" is not defined. [/src/mymy/mymy.csproj]
I put my source code in github: https://github.com/pearl2201/docker-aspnetcore-grpc
It is correct... they're not defined; with Grpc.Tools, imports still need to exist. You can use the ProtoRoot option on the <Protobuf ...> line to tell it where the root is, for this purpose. In BUILD-INTEGRATION there is also some mention of $(Protobuf_StandardImportsPath), but that seems to refer only to <ProtoCCommand>.
(as an aside: the protobuf-net tools include copies of all the common imports inside the package; if they aren't resolved from the file system, it looks to see what it has inside the assembly instead, but: this is not a direct change, as the protobuf-net tools output very different C#, intended for a different library implementation).
I am attempting to persist Keys to SQL using the PersistKeysToDbContext extension from services.AddDataProtection(). At the moment we are using PersistKeysToStackExchangeRedis which works really well, however a need was identitied to move it to DB instead.
We are using a .net Core 2.2 project having added the following references:
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (2.2.0)
Microsoft.AspNetCore.DataProtection.Extensions (2.2.0)
Microsoft.AspNetCore.DataProtection.StackExchangeRedis (2.2.0) (obviously for current functionality)
Microsoft.EntityFrameworkCore (2.2.0)
services.AddDataProtection().PersistKeysToDbContext<ApplicationDbContext>();
I get the following error from the compiler:
'IDataProtectionBuilder' does not contain a definition for 'PersistKeysToDbContext' and no accessible extension method 'PersistKeysToDbContext' accepting a first argument of type 'IDataProtectionBuilder' could be found (are you missing a using directive or an assembly reference?)
1) Make sure you have Microsoft.AspNetCore.DataProtection.Extensions + Microsoft.AspNetCore.DataProtection.EntityFrameworkCore installed (as references).
2) Add using Microsoft.AspNetCore.DataProtection; to Startup.cs (or wherever you have the problem).
I've tested and it works, so if it still doesn't work, you probably need to make sure you haven't missed anything.
I'm attempting to use the following command line command to compile an assembly of the code from my project:
C:/"Program Files"/Unity/Editor/Data/Mono/bin/gmcs
-target:library -out:C:/Users/Austin/Desktop/PixelExpanse.dll
-recurse:C:/Users/Austin/Desktop/Projects/Repos/trunk/PixelExpanse/SpaceColonyRefactor/Assets/Source/*.cs
-d:RUNTIME -r:C:/"Program Files"/Unity/Editor/Data/Managed/UnityEngine.dll
As you can see, I am, I believe, correctly referencing the UnityEngine.dll.
The code that would be compiled contains references to UnityEngine.UI and UnityEngine.EventSystems. But when I run the above command, I get the following compile error:
error CS0234: The type or namespace name 'EventSystems' does not exist in the namespace 'UnityEngine'. Are you missing an assembly reference?
From what I have been able to find through googling, it SEEMS like an error people were getting when using a pre-4.6 assembly, because thats when EventSystems and UI were both introduced. But I don't know how I could be missing that in the dll I'm referencing as Unity 5 is the only version that has ever touched this computer.
As a side note, I have posted this question to Unity Answers and have yet to receive a response. I expect it's because assembly compilation is beyond the scope of what most users there choose to undertake. Hence my asking it here.
The namespace UnityEngine.EventSystems actually appears in UnityEngine.UI.dll and not UnityEngine.dll so it seems you need to reference the former too when compiling manually from the command-line. Unity projects have this by default (see below).
This is verified by opening up the assembly in your reflector tool of choice, here I am using JetBrains dotPeek:
This is how my test project appears with default Unity references. Note that by default a reference to UnityEngine.UI already appears in the Unity-created project:
When I built my Windnows desktop app via Unity, the above dlls appeared in:
<drive>:<projectOutFolder>\<projectName>_Data\Managed
You can try:
right click on "project panel", and after "Reimport All".
It's can be happen due to switch between platforms, e.g. IOS, or Desktop.. thus, folrders are deleted by became unecessary..
Solve for me: Unity 5.2, Win 7, 32bits;
Good luck!
I checked the UnityEngine.dll and the Eventsystems/UI namespace is not included. Despite, there is a dll in Unity5\Editor\Data\UnityExtensions\Unity\GUISystem\UnityEngine.UI.dll which includes these namespaces.
For mac, it's /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll.
I needed to make a console application using nettiers class libraries. I created a new Console Application project, added references to all the libraries from NetTiers and created an app.config file with all the necessary configurations. I get intellisense and no errors and everything when I am doing the coding, but when I go to compile the application, I'm getting an error that PPGEDI.Data doesn't exist.
I only have 1 line in the program.cs Main method:
PPGEDI.Entities.VansEntity van
= DataRepository.VansEntityProvider.GetById(16);
I'm getting the following error:
Error 93
The type or namespace name 'Data'
does not exist in the namespace 'PPGEDI'
(are you missing an assembly reference?)
It's frustrating, because I know I've added the assembly reference:
I'm using Visual Studio 2010, with C# and .NET 4.0. Can anyone give me an idea as to what I need to do to get this to work.
As a note, this works if I use the same statement in a method on an ASPX page in the web application generated by nettiers.
#BrokenGlass, you were absolutely correct. I double checked and it was
set to ".NET Framework Client Profile", I changed it to .NET 4 and
it's working now, can you put that as an answer?
You are using the .NET client profile in your console app which is a "minified" version that doesn’t contain all assemblies.
The problem is that when your app adds a reference to a class library that is targeting the full framework, references to the "full" framework assembly will not resolve. This results in the rather non-forthcoming error message that you see. Switching to the the full .NET 4 as target framework will resolve the issue.
For a more in depth overview of the problem and the .NET 4 Client Profile in general also see "What’s new in .NET Framework 4 Client Profile RTM"