Re: Odd problem with Visual Studio

From: Frans Bouma [C# MVP] (perseus.usenetNOSPAM_at_xs4all.nl)
Date: 04/28/04


Date: Wed, 28 Apr 2004 01:20:31 -0700

Ken Allen wrote:

> I have been developing a suite of assemblies over the past couple of weeks,
> and this afternoon somethign started misbehaving.
>
> If I do not run the IDE and compiler the code from the command line, the
> compilation seems to work properly almost all of the time. More on this
> later.
>
> If I launch one copy of the IDE, then I can usually compile the project at
> least once. At some point, the build fails reporting "Could not copy
> temporary files to the output directory" and then indicates that one of the
> DLL could not be copied to the run directory. At this point I cannot even
> delete the file from the file explorer until I quit the IDE -- it seems that
> something is locking the file!
>
> I have tried to stop and start the IDE, log out and back in and even reboot,
> all to no avail. This has been working fine for over two weeks, with me
> running teo copies of the IDE -- one for debugging the server component and
> one for debugging the client component, both within the same system and
> sharing a couple of the assemblies. The DLL is question is one that is used
> by the server component only.
>
> The first indication something was different was when I compiled within one
> copy of the IDE, started that component, switched to the other IDE, and when
> I attempted to start that component running (debugging) it tried to
> recompile all of the assemblies again, and this fails since some of the
> assemblies are actually being used by the debug session in the other IDE
> instance. Since the components that fail are not ones that I needed to
> recompile, I generally ignored the problem and kept on debugging. This went
> on all day until finally one copy (and now both copies) refuse to
> successfully recompile, reporting the above error (on the same assembly).
>
> One thing I should note is that I have all of the assembly projects
> configured to place their resulting binaries (DLL or EXE) in the same
> directory. This is done to make it easier to debug the applications and
> services since the files are kept together.
>
> As part of the checks I made on the project, I deleted all of the files from
> the Drive:\Root\Bin\Release and Drive:\Root\Debug directories and then
> attempted to rebuild from scratch. I did locate one circular reference that
> I had introduced, and corrected that, and then I noticed that the *.csproj
> files are reference using the relative path to the debug directory, which
> meant that if I deleted all files and attempted to build the Release version
> it failed! I had to build the debug version first. After thinking about this
> I changed all of the project files to reference the dependant DLLs from the
> Release directory.
>
> I have not located the problem, and I am still unable to build the solution
> and not get this error if even one IDE is running -- but when I lauch and
> IDE, I can rebuild the entire solution once!
>
> Does anyoine have any idea why this is happening and what I can do to
> correct this?

        I assume you have a solution with projects A, B and C, and A references B
and C. Furthermore B and C reference both some given assembly. What I
sometimes see in this scenario is that B or C fail to compile due to this
error. If I first compile B and then C it's ok. You could try to set only one
of the references to copy local is true and the other to copy local is false.
This might solve the conflict.

        Another solution (no pun intended) is the separation of some projects into a
separate solution and reference the assemblies from the main solution, not
the projects.

                Frans.

-- 
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP


Relevant Pages

  • Re: Odd problem with Visual Studio
    ... >> If I launch one copy of the IDE, then I can usually compile the project at ... >> sharing a couple of the assemblies. ... I did locate one circular reference that ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Referencing in-memory assembly on compile
    ... Assembly object reference and saves it to a static field. ... more static initializer method to the code being compiled, ... Finally after you compile the assembly and load it you must ... loaded assemblies. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Project References (repost with fixed msdn alias)
    ... If we reference an assembly from some IDE known places. ... most famous IDE known folder for assemblies is, ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.general)
  • Re: Where is System.Collections when using csc.exe
    ... Copyright Microsoft Corporation 2001-2005. ... You should not reference assemblies in the GAC, ... can compile my code without errors. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Command line devenv not picking up dependencies on managed p
    ... commandline and it does not copy any of the C# reference assemblies to ... the build log shows that the xcopy command is incorrect. ... >> already been copied to the output folder by the manual compile. ...
    (microsoft.public.vsnet.ide)