Click here to Skip to main content
15,914,070 members
Home / Discussions / C#
   

C#

 
AnswerRe: All these event handlers Pin
DaveyM699-Oct-08 4:43
professionalDaveyM699-Oct-08 4:43 
GeneralRe: All these event handlers Pin
Dewald9-Oct-08 5:11
Dewald9-Oct-08 5:11 
AnswerRe: All these event handlers Pin
led mike9-Oct-08 4:47
led mike9-Oct-08 4:47 
AnswerRe: All these event handlers Pin
S. Senthil Kumar9-Oct-08 5:00
S. Senthil Kumar9-Oct-08 5:00 
GeneralRe: All these event handlers Pin
Dewald9-Oct-08 5:20
Dewald9-Oct-08 5:20 
GeneralRe: All these event handlers Pin
S. Senthil Kumar9-Oct-08 5:34
S. Senthil Kumar9-Oct-08 5:34 
GeneralRe: All these event handlers Pin
Dewald9-Oct-08 23:02
Dewald9-Oct-08 23:02 
QuestionIncluding c# v2.0 library in a c# v1.1 library. [modified] Pin
Spoon659-Oct-08 2:40
Spoon659-Oct-08 2:40 
Hi!

I got a problem I've been working on for 2 full days now. I hope someone can help me out here!

Summory:
How can I use a C#.dll compiled in .net v2.0 (v2.0.50727) in a C#.dll compiled in .net v1.1 (v1.1.4322)?

The whole story:
I made a library in C# which validates xml files with an xmlSchema. I include this library in Excel 2003 by following the normal ways to do this.
This all works fine!

Then I encountered the following problem. The system this library needs to run on has Excel 2002 installed! The problem with Excel 2002 is that it looks at libraries as if they are made in .net v1.1. It's possible to work around this problem by telling excel to look at the library from a v2.0 perspective by including an excel.exe.config in the excel directory. However, the users who have to use this library do not have administrator rights and the excel folder is read-only.

I tried to work around this problem by splitting up my library in 2 different libraries.
The first library is compiled as a v1.1 dll (Parser.dll), which i include in excel.
The other library is compiled as a v2.0 dll (XmlValidator.dll) and contains my xmlSchema validation code (not available in v1.1).

I want to make some calls to those v2.0 functions from my v1.1 dll.
And the problem is that I do not get this cross version call to work.

parser.dll
using ...

public class Parser
{
	private XmlDocument doc = new XmlDocument();

	public string ParseXml(string xmlPath)
	{
		if (XmlValidator.ValidateXml(xmlPath))
		{
			doc.Load(xmlPath);
			return "parsed";
		}
		else
		{
			return "validation failed";
		}
	}
}


XmlValidator.dll
using ...

class XmlValidator
{
	...
	public static bool ValidateXmlFile(string xmlPath)
	{
		doc = new XmlDocument();
		doc.Load(xmlPath);
		
		// validate and fill "validationMessage" with errors found
		doc.Validate(eventHandler);
		
		if (validationMessage != null)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	...
}


Both of the above files do what they should do seperately. Or when I include them in the same namespace and compile them both in v2.0.

I've been experimenting with the regasm.exe tool and typelibraries. But I can not find any decent examples from people with a similar problem.

So... any ideas?

Basje

modified on Thursday, October 9, 2008 9:03 AM

AnswerRe: Including c# v2.0 library in a c# v1.3 library. Pin
Pete O'Hanlon9-Oct-08 3:00
mvePete O'Hanlon9-Oct-08 3:00 
GeneralRe: Including c# v2.0 library in a c# v1.1 library. Pin
Spoon659-Oct-08 3:08
Spoon659-Oct-08 3:08 
AnswerRe: Including c# v2.0 library in a c# v1.1 library. Pin
Guffa9-Oct-08 3:12
Guffa9-Oct-08 3:12 
GeneralRe: Including c# v2.0 library in a c# v1.1 library. Pin
Spoon659-Oct-08 3:52
Spoon659-Oct-08 3:52 
GeneralRe: Including c# v2.0 library in a c# v1.1 library. Pin
Dave Kreskowiak9-Oct-08 5:24
mveDave Kreskowiak9-Oct-08 5:24 
GeneralRe: Including c# v2.0 library in a c# v1.1 library. Pin
Spoon659-Oct-08 22:11
Spoon659-Oct-08 22:11 
GeneralRe: Including c# v2.0 library in a c# v1.1 library. Pin
Spoon6513-Oct-08 22:37
Spoon6513-Oct-08 22:37 
GeneralRe: Including c# v2.0 library in a c# v1.1 library. Pin
Dave Kreskowiak14-Oct-08 1:52
mveDave Kreskowiak14-Oct-08 1:52 
AnswerRe: Including c# v2.0 library in a c# v1.1 library. Pin
Dan Neely9-Oct-08 4:06
Dan Neely9-Oct-08 4:06 
QuestionTabular crystal reports using query not through wizard Pin
tanvir20909-Oct-08 2:11
tanvir20909-Oct-08 2:11 
JokeRe: Tabular crystal reports using query not through wizard Pin
nelsonpaixao9-Oct-08 13:46
nelsonpaixao9-Oct-08 13:46 
QuestionStartUpForm / Splashscreen - Crossthreading / InvalidoperationException Pin
Piratenwichtl20009-Oct-08 0:25
Piratenwichtl20009-Oct-08 0:25 
AnswerRe: StartUpForm / Splashscreen - Crossthreading / InvalidoperationException Pin
S. Senthil Kumar9-Oct-08 3:53
S. Senthil Kumar9-Oct-08 3:53 
GeneralRe: StartUpForm / Splashscreen - Crossthreading / InvalidoperationException Pin
Piratenwichtl20009-Oct-08 4:10
Piratenwichtl20009-Oct-08 4:10 
GeneralRe: StartUpForm / Splashscreen - Crossthreading / InvalidoperationException Pin
S. Senthil Kumar9-Oct-08 4:51
S. Senthil Kumar9-Oct-08 4:51 
GeneralRe: StartUpForm / Splashscreen - Crossthreading / InvalidoperationException Pin
Piratenwichtl20009-Oct-08 6:30
Piratenwichtl20009-Oct-08 6:30 
QuestionAccess C# Variable in to java Script Function Pin
mharoonkhan8-Oct-08 23:48
mharoonkhan8-Oct-08 23:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.