-
August 19th, 2011, 06:59 PM
#1
codedomprovider references help
When I use the codedomprovider compiler I add .NET references by simply adding the path name:
foreach (string str in referenceList)
{
cp.ReferencedAssemblies.Add(str);
}
This works okay when normal .NET libraries but when I add my own .dll the compiled EXE will only work if the .dll is in the root folder of the EXE even if the path was set at something different. Why is this? Can the codedom by set to copy the dll to the root automatically so it doesn't throw this error?
Last edited by wurdup; August 21st, 2011 at 07:59 AM.
-
August 20th, 2011, 03:21 PM
#2
Re: codedomprovider references help
Originally Posted by wurdup
This works okay when normal .NET libraries but when I add my own .dll the compiled EXE will only work if the .dll is in the root folder of the EXE even if the path was set at something different. Why is this??
Assuming each str includes the full path of the assembly, it must ignore the path info and therefore can't find the dlls.
Originally Posted by wurdup
Can the codedom by set to copy the dll to the root automatically so it doesn't throw this error?
Probably not, but you can do this yourself.
-
August 20th, 2011, 06:58 PM
#3
Re: codedomprovider references help
the str is the full path yes. When it uses the standard .net it works ok ie c:/program files/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0/Profile/Client/System.dll
but when i use my own dll c:\myfolder\myLib.dll the compiled EXE throws a file not found error because it's looking for the dll in the exe folder. There must be a way for the compiler to do it automatically because VS2010 does it when I add the dll reference to my working project. It will save the dll to the bin/debug folder when I hit build and run.
I could do it manually by code to copy the dll there but how do I know which dll should be copied and which shouldn't? Not all standard libraries are in the \Reference Assemblies\ folder.
-
August 21st, 2011, 02:36 AM
#4
Re: codedomprovider references help
The standard libraries are found because they are registered in the GAC.
-
August 21st, 2011, 06:24 AM
#5
Re: codedomprovider references help
okay will try and find out how to copy dll if not registered thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|