Problem with DevExpress and just my machine - c#

I can navigate to the class in intellisense in the CS. I know it's there. Just can't figure out why I'm getting this error. The project works fine on other peoples computers.
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0012: The type 'DevExpress.Web.ASPxClasses.StylesBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a'.
Source Error:
Line 224:
Line 225: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 226: private void #__BuildControl__control2(DevExpress.Web.ASPxGridView.GridViewStyles #__ctrl) {
Line 227:
Line 228: #line 33 "E:\...\page.aspx"
Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\94947553\afb27c33\App_Web_pagemanager.aspx.8f36609.6x9twr-m.0.cs Line: 226

Do you have this assembly reference in your project? And if you do is it the right version? or do you have Specific Version = True (if you don't have the exact version).
Compiler Error Message: CS0012: The type 'DevExpress.Web.ASPxClasses.StylesBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a'.
If you have have the reference and Specific Version = False it should work.

You sound like you might be in a situation I was in earlier this year, so I will tell you what worked for me:
Right click on your project in Solution Explorer and click on the Application tab. Check that your target framework is ".NET Framework 4" (or 3.5 etc.).
If it is targeting ".NET Framework 4 Client Profile" and the DevExpress assembily makes use of features not available to the cliet profile, then you find that your reference is ignored.

Related

Unknown build error, mapping URI is not valid

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?

Error when using RazorTemplates library: 'CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced'

On some machines, executing a razor template via RazorTemplates works OK.
On others, I receive the following message:
TemplateCompilationException
error CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Info:
This is within a WPF application running on .NET 4.7.
The assembly has a reference to System.Runtime.4.3.0\lib\net462\System.Runtime.dll (v4.1.1.0)
However at runtime, this assembly does not show up in the 'Modules' list.
It seems the Attribute object exists in both System.Runtime and mscorlib.
Looks like this is an underlying issue somewhere between win10 and the RazorTemplates library.
In the end i switched from RazorTemplates to RazorEngine: https://github.com/Antaris/RazorEngine
And there is a page here that explains how to fix the problem via a Resolver:
https://github.com/Antaris/RazorEngine/issues/416
System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.
This could happen for two possible reasons:
It's not on the machine.
It's the wrong version.
For the machines this fails on check what version of the .Net runtime they have and/or inspect the GAC for this file and version.
Missing the framework, install it. :-)
If machines have a version but it's not the expected version do either:
Install the correct framework version
Use a binding redirect in your config file

How to check the version of an assembly (dll)?

I have c# application and when I made a change, I am getting the error message:
An unhandled exception of type 'System.TypeLoadException' occurred in
WindowsFormsApplication1.exe
Additional information: Could not load type
'TradeIdeas.TIProData.OddsMakerColumnConfiguration' from assembly
'TIProData, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’.
This message says the version number of dll (TIProData) is 1.0.0.0. I think there is a later version available. How can I tell the version number of a dll on my machine?
You can use Reflector, ILDASM or ILSpy to get the assembly version.
You usually can find ILDASM in C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\ildasm.exe (where v8.1A is the version of the Windows SDK installed).
ILDASM:
Reflector:
There is a couple of ways to do it:
If you reference the dll in Visual Studio right click it (in ProjectName/References folder) and select "Properties" you have "Version" and "Runtime Version" there.
In File Explorer when you right click the dll file and select properties there is a "File Version" and "Product Version" there.
Alternatively, investigate it in code:
Assembly assembly = Assembly.LoadFrom("TestAssembly.dll");
Version ver = assembly.GetName().Version;
If you know Class, that belongs to assembly, you can use GetTypeInfo
var runtimeVersion = typeof(MyClass)
.GetTypeInfo()
.Assembly
.GetCustomAttribute<AssemblyFileVersionAttribute>();
String ver=RuntimeVersion.Version;
 
The example is for .Net Core
from https://developers.de/blogs/damir_dobric/archive/2017/06/27/how-to-deal-with-assembly-version-in-net-core.aspx
You can use AssemblyName.GetAssemblyName(string path) from a little util app.
Further details here on MSDN.
From Powershell (PSCore):
$assembly = [System.Reflection.Assembly]::LoadFrom("$pwd\System.Memory.dll")
Besides $assembly.FullName you can pick up any other prop from the object.

Error trying to use WordsSegmenter.GetTokens()

The code:
WordsSegmenter s = new WordsSegmenter("en-US");
var words = s.GetTokens("The price of this API is €10,000.99.");
gives me a build error: "Error 2 The type 'System.Collections.Generic.IReadOnlyList`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I have System.Collections.Generic referenced and suspect that the error above is disguising the real problem.
I'm building this in Visual Studio Express for Windows Desktop. Do I perhaps have to use VS Express for Windows?
Changing the target Framework of my project to other 4.x versions doesn't help.
Two actions fixed this: Opening my project.csproj file in a text editor and changing the TargetPlatformVersion node to "8.1". Then added references to Windows.winmd and Windows.Runtime.WindowsRuntime.dll.
Kudos to Xavier H at Intel for this post: https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications

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.

Categories