Discussion:
[Nant-users] Access denied using copy task for ASP.Net project
Peter McEvoy
2004-04-07 15:17:17 UTC
Permalink
Folks,
I am using NAnt to build a number of web projects and then to deploy them to
an IIS instance. Occasionally, the deploy fails with a "Cannot Copy
'<file>'. Access to the path '<file>' is denied". where <file> is some
assembly that needs to be replaced.

If I run the deploy again, it will usually work (occasionallt not, but
persistance pays off and it will eventually deploy).

Now I presume this is something to do with the IIS thread accessing the
assembly at the same time that I want to overwrite it.

I do not want to set failonerror="false" as I do actually want to replace
the files.

The same error can happen if I try to delete the remote files before
deploying.

Is this a "feature" of the so-called MS .Net XCopy deploy functionality? Is
there anything that I can do to ensure that the delete and copy will
actually work, as this error is not really making life easy for a hands-off
build and deploy

Cheers
Pete
Bob Archer
2004-04-07 16:24:52 UTC
Permalink
Well,

ASP.Net is actually supposed to make copies of the DLL's in the bin
folder and use the copies. It does this to facilitate XCOPY deployment
and live updates. I'm not sure why you are having the problem.

Are you ALWAYS able to copy them using the command line? Have you tried
to use the shell to copy the files using the EXEC task?

Bob


-----Original Message-----
From: nant-users-***@lists.sourceforge.net
[mailto:nant-users-***@lists.sourceforge.net] On Behalf Of Peter
McEvoy
Sent: Wednesday, April 07, 2004 11:17 AM
To: nant-***@lists.sourceforge.net
Subject: [Nant-users] Access denied using copy task for ASP.Net project

Folks,
I am using NAnt to build a number of web projects and then to deploy
them to
an IIS instance. Occasionally, the deploy fails with a "Cannot Copy
'<file>'. Access to the path '<file>' is denied". where <file> is some
assembly that needs to be replaced.

If I run the deploy again, it will usually work (occasionallt not, but
persistance pays off and it will eventually deploy).

Now I presume this is something to do with the IIS thread accessing the
assembly at the same time that I want to overwrite it.

I do not want to set failonerror="false" as I do actually want to
replace
the files.

The same error can happen if I try to delete the remote files before
deploying.

Is this a "feature" of the so-called MS .Net XCopy deploy functionality?
Is
there anything that I can do to ensure that the delete and copy will
actually work, as this error is not really making life easy for a
hands-off
build and deploy

Cheers
Pete


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
Jaroslaw Kowalski
2004-04-07 18:10:17 UTC
Permalink
Post by Peter McEvoy
Is this a "feature" of the so-called MS .Net XCopy deploy functionality? Is
there anything that I can do to ensure that the delete and copy will
actually work, as this error is not really making life easy for a hands-off
build and deploy
It can be some anti-virus software doing their job. Some AVses are badly
broken and lock *.exe, *.dll files in the most unexpected moments. I don't
know if this may be the case with you.

Jarek
Castro, Edwin Gabriel (Firing Systems Engr.)
2004-04-07 18:32:50 UTC
Permalink
I have noticed that VS.NET sometimes locks assemblies after building
them. I have had problems where a build fails because the assembly could
not be deleted (as in a clean operation). I don't see this problem if
I'm using the command line (i.e. devenv.com). Don't know that this
VS.NET behavior is related but it may help you get some insight into
your problem.

--
Edwin G. Castro
Firing Systems Engineer
***@hp.com

-----Original Message-----
From: nant-users-***@lists.sourceforge.net
[mailto:nant-users-***@lists.sourceforge.net] On Behalf Of Peter
McEvoy
Sent: Wednesday, April 07, 2004 8:17 AM
To: nant-***@lists.sourceforge.net
Subject: [Nant-users] Access denied using copy task for ASP.Net project

Folks,
I am using NAnt to build a number of web projects and then to deploy
them to
an IIS instance. Occasionally, the deploy fails with a "Cannot Copy
'<file>'. Access to the path '<file>' is denied". where <file> is some
assembly that needs to be replaced.

If I run the deploy again, it will usually work (occasionallt not, but
persistance pays off and it will eventually deploy).

Now I presume this is something to do with the IIS thread accessing the
assembly at the same time that I want to overwrite it.

I do not want to set failonerror="false" as I do actually want to
replace
the files.

The same error can happen if I try to delete the remote files before
deploying.

Is this a "feature" of the so-called MS .Net XCopy deploy functionality?
Is
there anything that I can do to ensure that the delete and copy will
actually work, as this error is not really making life easy for a
hands-off
build and deploy

Cheers
Pete


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
Derek Pierson
2004-04-07 16:46:12 UTC
Permalink
Peter,



I have that problem before and I solved it by running the iisreset command
from my NAnt script.



Derek

Loading...