Unknown build error, mapping URI is not valid - c#

I have the following defined in my XAML file:
xmlns:databaseDesign="clr-namespace:My_Namespace;assembly=My Assembly Name
Intellisense picks it up without any issue and I can use autocomplete to grab classes and whatnot from that assembly in my XAML. However, when I go to build, I get the following error:
Error MC1000: Unknown build error,
''clr-namespace:My_Namespace;assembly=My Assembly Name' mapping URI is
not valid. Line 14 Position 14.' (14, 14)
The only thing I can think of that is different from my previous similar projects is that I am referencing an assembly from a private nuget repo rather than directly from the solution.
Using .NET Core 3.1 for both this project and the referenced library.
Any thoughts on what might be going wrong?

Turns out, assembly names with spaces aren't handled, with no indicator that this is the issue. Really, Microsoft?

Related

Blazor application generates wrong MvcApplicationPartsAssemblyInfo.cs

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.

Using Autofac get error "could not load file or assembly 'system.web.mvc version=5.1.0.0"

I'm using Autofac.Mvc 4.0.0.0 and my System.Web.MVC version is 5.2.3.0. It's build success but getting this error when i run project.
This problem is solved, just post it to help someone like me.
Finally, it's a Microsoft's bug already report here, This issue on github is closed, see detail. Any "could not load assembly" exception may be due to this bug.
Point is don't let project directory start with "#" after drive letter if you are using AssemblyBinding(two project using different version of same assembly, config AssemblyBinding let them using same version when one project reference another)

Why am I getting the following error when compiling this assembly?

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.

Problem with error messages in solution

I have a solution with around 10 projects, I have not written any of this myself, but I'm going to take over a project here. The project that is the main project is based on WPF. When I try to run this project, I get the following compiler error:
The tag 'RoutingManagerView' does not exist in XML namespace 'clr-namespace:RoutingManager.Views;assembly=RoutingManager'. Line 29 Position 14. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient
Then, if I double click this error message, so that the xaml is opened, and the designer is loaded, the designer does not load, and I get 3 more error messages:
Unable to load the metadata for assembly 'WsaClient'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'WsaClient' or one of its dependencies. The system cannot find the file specified. C:\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient
Unable to load the metadata for assembly 'RoutingManager'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'RoutingManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. C:\Steria\Forsvaret\P6088\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient
The type 'Views:RoutingManagerView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient
I googled it, and many have suggested that this is because a DLL is locked since it originates from the internet. However in my condition, I do not have a DLL. It's complaining on two projects that are a part of the solution, WsaManager and RoutingManager. I got all the source code on a zip file on an usb pen, and I have extracted it to somewhere on my c drive, so there is no remote access of the code.
If anyone have had the same or similar problem earlier, I would highly appreciate any pointers here on how to resolve this.
EDIT
The last error message is given on this line in the XAML file:
<Views:RoutingManagerView DataContext="{Binding Dependency}"/>
And on the top of the XAML file, this is the import for the assembly:
xmlns:Views="clr-namespace:RoutingManager.Views;assembly=RoutingManager"
Resolve this by right clicking on the solution and choosing 'Rebuild Solution'
An additional point for other readers: if your projects builds successfully, but you get this error message while trying to load your view in the designer, make sure your assembly is x86 or Any CPU, because Visual Studio 2010 is a 32bit process and cannot load x64 assemblies in the designer.
To resolve this problem, I had to compile the projects one by one, starting from the project with no dependencies on other projects, and then working my way "up".
It seems that the Build all did not manage to do this properly automatically.
Try this, this was the only advice that worked for me:
Unable to load the metadata for assembly ''. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545.  The following error was encountered during load: Could not load file or assembly '' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
In WPF project to allow the project to load from remote source we have to enable it in the configuration file devenv.exe.config.
Step 1: Search the configuration file devenv.exe.config in your system. Usually it is located at
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
Step 2: Edit the configuration file. Add following line in the tag
<loadFromRemoteSources enabled="true" />
Step3: Restart your visual studio.
http://exacthelp.blogspot.cz/2012/02/unable-to-load-metadata-for-assembly.html
Unable to load the metadata for assembly 'WsaClient'. This assembly
may have been downloaded from the web. See
http://go.microsoft.com/fwlink/?LinkId=179545. The following error was
encountered during load: Could not load file or assembly 'WsaClient'
or one of its dependencies. The system cannot find the file specified.
C:\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient
I run into same error: I can build and run my project, but I can not design XAML. I realized that it was local configuration issue because it's not replicable on my other machine (using same repository revision).
I started digging more and figured out that VS 2010 does not like # symbol in path. So error shows up when I have my sources in
C:\#projects\<my project>
After I moved them to
C:\projects\<my project>
Problem is gone.
I hope this will help to someone else.
I suspect the ..
The tag 'RoutingManagerView' does not exist in XML namespace 'clr-namespace:RoutingManager.Views;assembly=RoutingManager'. Line 29 Position 14. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient
.. error is causing a cascade of other errors. It looks like you're trying to create a RoutingManagerView from the namespace RoutingManager.Views in the assembly RoutingManager. However, it is not there. Make sure the class is visible to the outside world. Or try to clean and rebuild the solution and see on which project the first error occurs. Because if the projects are interdependent, an error in one project might cause reference errors in others.

ASP.NET MVC 3 - Issues with microsoft-web-helpers v1.1

I upgraded my microsof-web-helpers package from nuget and it itself depends on facebook and twitter APIs. Now when my app attempts to run I get the following error:
Compiler Error Message: CS0246: The type or namespace name 'SimpleMembershipProvider' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 216: }
Line 217:
Line 218: private static SimpleMembershipProvider GetMembershipProvider() {
Line 219: var provider = Membership.Provider as SimpleMembershipProvider;
Line 220:
Source File: c:\Users\jp\documents\visual studio 2010\projects\myproj\myproj\App_Code\Facebook.cshtml Line: 218
I was wondering if anyone has come across this issue and can tell me if I need to add any additional references to my project or, worse, create a dummy SimpleMembershipProvider in my app. I am hesitant to update the facebook code because, anytime I get the latest microsoft-web-helpers from nuget i'll be forced to maintain this file.
Thanks
JP
I have the same problem.
After some googling I've found simple solution for this issue. As described here, all you need is just copy the WebMatrix.Data.dll and WebMatrix.WebData.dll files to your bin directory.
But I suggest to add references to WebMatrix.Data.dll and WebMatrix.WebData.dll to the project (and set "Copy Local" property to true for them). Then these files will be copied to the bin directory always after build, even if you remove the bin directory (which is preferred if you use version control).

Categories