C# compile problem
Error 3 The assembly "c:\dev\my Documents\VstdioProj\C#\SomeClass\SomeClass\bin\Release\SomeClass.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'SomeClass, SomeClass'. Error: Element not found. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\Microsoft.Common.targets 2674 9
In the foldler C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215, I found the following folders:
1033
CONFIG
MSBuild
MUI
RedistList
ASP.NETWebAdminFiles
Microsoft .NET Framework 2.0 Beta 2
Temporary ASP.NET Files
and the file Microsoft.Common.targets
In other word, don't I have the fiel what what C# need?
However what does " 2674 9 " mentioned in the error message mean?
what can I do to fix it?
[774 byte] By [
ggunn] at [2008-2-4]
Thank you for your time.
You are right on. I was trying to compile a test COM component in C#.
I know it is not the ID, nor .net framework being corrupt; I was able to compile a VB .net COM component successfully and ran simple test against it. And I just rechecked that.
here is the source code:::::::::::::::::::
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[Guid(guid), ComVisible(true)]
public class SomeClass
{
#region COM_GUIDs definition
public const string guid = "9b4d2768-b95e-42d7-8cba-3027f154b1c8";
#endregion
[ComVisible(true)]
public bool isInitialized = false;
public SomeClass()
{
isInitialized = true;
}
[ComVisible(true)]
public int testInt()
{
return 6999;
}
public int ReturnStringArray(String sIn, out String[] newStrs)
{
newStrs = sIn.Split(' ');
return newStrs.Length;
}
public int testscalar(String sIn, out String newStrs)
{
String[] strs = sIn.Split(' ');
newStrs = strs[0];
return newStrs.Length;
}
public int testBStr(String sIn, ref BStrWrapper[] newStrs)
{
int i = 0;
foreach (String s in sIn.Split(' '))
{
newStrs
= new BStrWrapper(s);
i++;
}
//return newStrs.Length;
return i;
}
}
//-- end of source code
The Project has been set with COM visible, register for COM interop.
Did I get the contrcutor wrong for COM?. I just looked up C# help for constructor and changed my code to above.
I still get the error message
Error 3 The assembly "c:\...\SomeClass\SomeClass\bin\Release\SomeClass.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'SomeClass, SomeClass'. Error: Element not found. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\Microsoft.Common.targets 2674 9
I haven't received a reply in a week. Therefore, I must assume you've resolved this question.
Whether it's because you found a solution, workaround, or simply given up on the question, an answer now would likely be of no use to you. Since it is unlikely that we'll ever find an answer to this problem (even if we do you won't see it because you're no longer reading these forums), and to ease searching in this forum, I'll mark this question as resolved.
If you don't agree to this, please feel free to unmark the answer and reply what part of the problem you still are having trouble with.