assembly cant access System.Xml

K

Karl Hungus

A cs file I compiled into an assembly dll is in my bin directory. In the cs
file I have a using statement for System.Xml
I compiled it using this command: csc /out:XmlContent.dll /t:library
XmlContent.cs

When I run my aspx page, which has a codebehind that instantiates the object
from in my assembly, I get the following error, anyone know why?


File or assembly name System.Xml, or one of its dependencies, was not found.
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.IO.FileNotFoundException: File or assembly name
System.Xml, or one of its dependencies, was not found.

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.

Assembly Load Trace: The following information can be helpful to determine
why the assembly 'System.Xml' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = System.Xml, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///D:/html/users/testorg/html
LOG: Initial PrivatePath = bin
Calling assembly : XmlContent, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null.
===

LOG: Publisher policy file is not found.
LOG: No redirect found in host configuration file
(C:\WINNT\Microsoft.NET\Framework\v1.0.3705\aspnet.config).
LOG: Using machine configuration file from
C:\WINNT\Microsoft.NET\Framework\v1.0.3705\config\machine.config.
LOG: Post-policy reference: System.Xml, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml/System.Xml.DLL.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml.DLL.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml/System.Xml.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml.EXE.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml/System.Xml.EXE.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml.EXE.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml/System.Xml.EXE.


Stack Trace:

[FileNotFoundException: File or assembly name System.Xml, or one of its
dependencies, was not found.]
Test.XmlContent..ctor(String xmlFile) +0
MyCodeBehind.Page_Load(Object Src, EventArgs E) +27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
 
M

Marshal Antony

Hi Karl,
If you are building an assembly which references Microsoft's
System.Xml.dll you can specify the /reference:System.Xml.dll switch when
invoking CSC.exe to resolve the issue.The compiler will find the
System.Xml.dll in the directory which contains the CLR which the compiler
itself is using to produce the assembly.
Additionl info: But at runtime System.dll will be loaded from the GAC .So
we have 2 copies of Microsoft'a assembly files.
Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com





Karl Hungus said:
A cs file I compiled into an assembly dll is in my bin directory. In the cs
file I have a using statement for System.Xml
I compiled it using this command: csc /out:XmlContent.dll /t:library
XmlContent.cs

When I run my aspx page, which has a codebehind that instantiates the object
from in my assembly, I get the following error, anyone know why?


File or assembly name System.Xml, or one of its dependencies, was not found.
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.IO.FileNotFoundException: File or assembly name
System.Xml, or one of its dependencies, was not found.

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.

Assembly Load Trace: The following information can be helpful to determine
why the assembly 'System.Xml' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = System.Xml, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///D:/html/users/testorg/html
LOG: Initial PrivatePath = bin
Calling assembly : XmlContent, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null.
===

LOG: Publisher policy file is not found.
LOG: No redirect found in host configuration file
(C:\WINNT\Microsoft.NET\Framework\v1.0.3705\aspnet.config).
LOG: Using machine configuration file from
C:\WINNT\Microsoft.NET\Framework\v1.0.3705\config\machine.config.
LOG: Post-policy reference: System.Xml, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml/System.Xml.DLL.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml.DLL.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml/System.Xml.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml.EXE.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET
Files/root/d1dc28bf/188ad8f0/System.Xml/System.Xml.EXE.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml.EXE.
LOG: Attempting download of new URL
file:///D:/html/users/testorg/html/bin/System.Xml/System.Xml.EXE.


Stack Trace:

[FileNotFoundException: File or assembly name System.Xml, or one of its
dependencies, was not found.]
Test.XmlContent..ctor(String xmlFile) +0
MyCodeBehind.Page_Load(Object Src, EventArgs E) +27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724



-------------------------------------------------------------------------- --
 
K

Karl Hungus

Hey Marshal,

Thanks for your reply. I tried that and it wasn't successful. I now believe
the problem is related to different framework versions. Locally I have v1.1
and on my server its v1.0

Im currently searching for ways to deal with this. Please let me know if you
have any solution.

Thanks,
Karl
 
M

Marshal Antony

Hi Karl,
If you are running v 1.0 and 1.1 side by side read the link below :
http://www.asp.net/faq/SideBySide.aspx

Once version 1.1 of the .NET Framework is installed,by default
all of the web applications will use
v 1.1 eventhough 1.0 exists.
It is useful for you to know about response files to make
your compilation easier.A response file is a text file
that contains a set of compiler command-line switches.Here is a link on
MSDN for that..

http://msdn.microsoft.com/library/d...n-us/cscomp/html/vcerrspecifyresponsefile.asp

You might consider using Visual Studio .NET which will do
all the compilation for you.
It will increase your productivity dramatically in so many ways.

Hope this helps,
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top