MonoDevelop error - mono

I developed one Mono project which runs perfectly on MonoDevelop in Windows, but it throws a compiler error like System.Services DLL error. The exact error message is
Compiler Error Message: CS0234: The type or namespace name 'ServiceModel' does not exist in the namespace 'System' (are you missing an assembly reference?)
What could be the problem?

System.ServiceModel is provided by the System.ServiceModel.dll assembly. You should be able to choose this by right clicking on the "Refrences" folder in the solution tree and choosing "Edit".
You should also take note that WCF on mono is not 100% complete. It may however do what you need.

Yοu can add the missing assemblies by using below command in linux:
gacutil -i System.Data.dll
and adding during compile time is:
gmcs filename -r:System.Data.dll

Related

DLL cannot be found when I specify the path and the dll has no missing dependencies

I am writing a program which refers to a dll using the words "Declare"
Whenever I run the program I get an error saying "File not found: x.dll". I tried specifying the whole path, still an error. I tried registering the dll, gives me an error.
I opened the Visual Studio Depends program to see if the dll has missing dependencies and found nothing that could be troubling it.
What could be the cause of this?
Thanks!

SharpSVN error in VS2010

I'm trying to get SharpSVN to work with a VB.NET project I'm working on in VS2010. I've added SharpSVN.dll to my project references but the following error appears when I try to load the site:
Could not load file or assembly 'SharpSvn' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'SharpSvn' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
My machine is 64-bit, and I've set the Configuration Manager to build to x64 as well as copied the 64-bit version of SharpSVN.dll into my project's bin directory. Additionally, I've also tried setting build to x86 and using the x86 version of SharpSVN.dll and the same error appears (so I suspect the error may not be directly related to instruction set family).
In my config file, I've tried adding the following to the assemblies attribute:
<add assembly="SharpSvn, Version=1.6016.1637.10768, Culture=neutral, PublicKeyToken=d729672594885a28"/>
Any ideas?
I have the same error and can't explain what's going on. However, with the 32bit version, the error is more descriptive:
Unhandled Exception: System.IO.FileLoadException: Mixed mode assembly is built against
version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without
additional configuration information.
Which you can fix by adding the following snippet to your app.config
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
Not sure what's wrong with the 64bit version, but you can always build it from source.
Despite thinking that <add assembly> was enough, I actually solved this issue by adding SharpSvn to GAC (in case anybody is running into this problem as well).
I am not sure why adding to the GAC worked for you, this is not the correct behavior for the assembly loader.
The error refers to the bitness of an assembly. SharpSVN is a mixed mode assembly, ie: it contains both managed and unmanaged code. You must specifically target x86 (with the x86 SharpSVN Assembly) or x64 (again with appropriate assembly). You must further set all your assemblies to be explicitly x86 or x64. Targeting Any CPU will allow the runtime to make this decision for you, and it will fail to load SharpSvn.dll if it picks a word length that does not match the SharpSvn DLL.

Nant build error: error CS0234: The type or namespace name 'Localization' does not exist

I have a decent size Nant build file (8 projects) where projects depend on eachother and so on, and everything works fine. But I went to add in a new project (first in the build order), it compiles fine and the dll shows up, but when I go to reference it in another, I get the error:
error CS0234: The type or namespace
name 'Localization' does not exist in
the namespace 'XXX' (are you missing
an assembly reference?)
Now in that csc command, I clearly have
<include name="./bin/XXX.Localization.dll"/>
I have checked the directory and it is there, I am very confused as to what is happening. In this project, I also have a bunch of references to other dlls in the same directory that work fine. Thanks for your time.
Since the project had no .cs files in it, it didn't work right (only resx files). I simply added in a dummy class and it worked fine.

doing msbuild from the command line: getting errors for the referenced namespace 'Microsoft.VisualStudio.TestTools'

i'm compiling a .net 3.5 solution with msbuild with this line of code:
msbuild.exe n:\temp\Thisnight.sln /p:Configuration=Debug /v:diag
and it gives me this error:
error CS0234: The type or namespace name 'UnitTesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
i've gotten the latest source which (off course) builds in VS2010 itself.
Can't seem to figure out what i'm missing here....
EDIT
Seeing higher up in the command window this message:
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference.
Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutra
l, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
I don't think i have to include this DLL by my project (because it's a MS dll?)
EDIT
What i've seen now: all projects are for the .Net 3.5 framework, but the testproject (which is the one giving me problems) is for the .Net 4.0 framework.
And the weird thing is: i can't change it.
It's a vs2010 solution with web. webservice,winforms,dll,setup and testprojects
did you run vcvars32.bat in your cmd shell?
If you look at the Microsoft.Common.Targets file you will see :
<!--
The SearchPaths property is set to find assemblies in the following order:
(1) Files from current project - indicated by {CandidateAssemblyFiles}
(2) $(ReferencePath) - the reference path property, which comes from the .USER file.
(3) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
(4) The directory of MSBuild's "target" runtime from GetFrameworkPath.
The "target" runtime folder is the folder of the runtime that MSBuild is a part of.
(5) Registered assembly folders, indicated by {Registry:*,*,*}
(6) Legacy registered assembly folders, indicated by {AssemblyFolders}
(7) Resolve to the GAC.
(8) Treat the reference's Include as if it were a real file name.
(9) Look in the application's output folder (like bin\debug)
-->
VS runs MSBuild in its own environment, I don't know the differences either but did you try adding the lacking assembly path in command line by modifying the AssemblyFolders items. You have a tuto here : http://www.beefycode.com/post/Resolving-Binary-References-in-MSBuild.aspx .
Hope this helps.
try running:
msbuild /version
Make sure it's the 3.5 version and not something older.
Make sure the MS dll is here, or somewhere like that:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

Mono - Could not load file or assembly

i just exported my project to my new imac an loaded my solution into monodevelop.
After the successfully compilation i started the project, and i always getting the same error.
** (/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/2.0/xsp2.exe:1576): WARNING **: The following assembly referenced from /private/var/folders/9y/9ypfv24bEwieHw+Yy+PUsU+++TI/-Tmp-/nhu-temp-aspnet-0/ebc9e2c6/assembly/shadow/7f5f6265/859daf16_fac2cd73_00000001/Centrism.Administration.UI.dll could not be loaded:
Assembly: Centrism.Core (assemblyref_index=3)
Version: 0.0.3688.40278
Public Key: (none)
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/var/folders/9y/9ypfv24bEwieHw+Yy+PUsU+++TI/-Tmp-/nhu-temp-aspnet-0/ebc9e2c6/assembly/shadow/7f5f6265/859daf16_fac2cd73_00000001/).
** (/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/2.0/xsp2.exe:1576): WARNING **: Could not load file or assembly 'Centrism.Core, Version=0.0.3688.40278, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
In other projects the assembly works correct and can be loaded.
I had the same problem with a dll that was in the same path as the application assembly, the problem was that the dll name had a different case than the expected one. So the Abc.dll was missing, in the folder it was named abc.dll, after renaming, it worked.
I guess I'm going to ask the obvious:
Do you have Centrism.Core.dll somewhere that Mono knows about and can get to?
If your project is referencing the Centrism.Administration.UI.dll, and it is not in the GAC on your iMac, the easiest solution would probably be to set the reference to that assembly to "Local Copy". For web projects, this will copy the assembly into the application's Bin directory, where xsp should be able to pick it up.
I had this error when adding a new assembly to an existing project (which itself was referenced by a unit test project).
Because the assembly wasn't included in both projects, the unit test would error out. The solution was to add a Copy tag to the project file:
<Copy SourceFiles="$(ProjectDir)\dlls\NewAssembly.dll" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true" />
Presumably it would also work to add the reference directly to the unit test (this reference is not used directly, so was able to avoid using above).