locked
bug in visual studio? building .dll dependant project removes .dll file from class library project folder. RRS feed

  • Question

  • User-1982615125 posted

    everytime when i click on 'rebuild solution'. all my original class library .dll files get removed from their own projects. it looks like instead of copying the .dll files to the solution, it bugs to MOVE them instead, removing the old copy.

    then i get a build error on the next rebuild, saying that the files cannot be found. so i have to open all the class library projects and build them all by hand.

    ::::::::::::::::::::::::::::::::::::::::::::

    Severity Code Description Project File Line Suppression State
    Warning Could not resolve this reference. Could not locate the assembly "ModelDatabaseClient". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

    Sunday, June 10, 2018 8:20 PM

All replies

  • User1120430333 posted

    Maybe you should look into using Nuget. I can work on projects on all the machines on my network, switching between machines on the network. Nuget package management keeps everything in sync with the projects. I also use TFS Express (free), a code repository,  too that allows me to work on the code switching between machines.

     https://docs.microsoft.com/en-us/nuget/what-is-nuget  

    Monday, June 11, 2018 8:10 AM
  • User-1982615125 posted

    interesting

    how can i store and publish/retrieve these packages?

    Monday, June 11, 2018 9:26 AM
  • User1120430333 posted

    interesting

    how can i store and publish/retrieve these packages?

    When you use Nuget to install a DLL, a Nuget package into a project, where you will right-click the project to get to Nuget at the project level using Visual Stuido., then a package.config file is placed into the project. It's how VS and Nuget work together to get the right DLL(s) into the project. 

    If you use TFS Express (free) as the code repository, the Nuget packages.config is checked into the repository with the rest of the project source code and they are controlled by TFS. So for instance, you could have a band new machine that doesn't have the folder with for the VS solution. You can create the project folder for the solution  on the hard drive, go to TFS and tell TFS to get the latest code for the entire solution including the packages.config file and start the build of the solution. And Nuget and Visual Stuido will get the needed DLL(s) for each project placing them into the Bin folder. 

    An example of the packages.config for a MVC project. The packages.config gets created at the initial creation of the project. And then other packages were added as needed or removed ad needed. 

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="Antlr" version="3.4.1.9004" targetFramework="net461" />
      <package id="bootstrap" version="3.0.0" targetFramework="net461" />
      <package id="EntityFramework" version="6.1.3" targetFramework="net461" />
      <package id="jQuery" version="1.10.2" targetFramework="net461" />
      <package id="jQuery.Validation" version="1.11.1" targetFramework="net461" />
      <package id="log4net" version="2.0.8" targetFramework="net461" />
      <package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net461" />
      <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net461" />
      <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net461" />
      <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net461" />
      <package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net461" />
      <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net461" />
      <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net461" />
      <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net461" />
      <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net461" />
      <package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net461" />
      <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net461" />
      <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net461" />
      <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
      <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net461" />
      <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.7" targetFramework="net461" />
      <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net461" />
      <package id="Microsoft.Net.Compilers" version="2.1.0" targetFramework="net461" developmentDependency="true" />
      <package id="Microsoft.Owin" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net461" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
      <package id="Modernizr" version="2.6.2" targetFramework="net461" />
      <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net461" />
      <package id="Owin" version="1.0" targetFramework="net461" />
      <package id="Respond" version="1.2.0" targetFramework="net461" />
      <package id="WebGrease" version="1.5.2" targetFramework="net461" />
    </packages>

    Monday, June 11, 2018 12:22 PM
  • User475983607 posted

    everytime when i click on 'rebuild solution'. all my original class library .dll files get removed from their own projects. it looks like instead of copying the .dll files to the solution, it bugs to MOVE them instead, removing the old copy.

    then i get a build error on the next rebuild, saying that the files cannot be found. so i have to open all the class library projects and build them all by hand.

    ::::::::::::::::::::::::::::::::::::::::::::

    Severity Code Description Project File Line Suppression State
    Warning Could not resolve this reference. Could not locate the assembly "ModelDatabaseClient". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

    This type of issue is usually caused by a compiler error in one of the projects or one of the projects is running and the dll cannot be accessed or moved.  The output or error list view in Visual Studio will show these types of errors on rebuild.

    Otherwise, we'll need to know more about what you're doing to cause this error.

    Monday, June 11, 2018 1:12 PM
  • User283571144 posted

    Hi fazioliamboina,

    everytime when i click on 'rebuild solution'. all my original class library .dll files get removed from their own projects. it looks like instead of copying the .dll files to the solution, it bugs to MOVE them instead, removing the old copy.

    then i get a build error on the next rebuild, saying that the files cannot be found. so i have to open all the class library projects and build them all by hand.

    As mgebhard says, if your main application project has added reference for the class library application project, the VS will rebuild all the project when you rebuild the main application.

    So you will find all the dll have removed.

    If the VS find the class library is wrong and couldn't complie, it will directly remove the class libaray dll in the main project and show below error.

    I suggest you could firstly check the class library to make sure there are noting wrong in it.

     

    how can i store and publish/retrieve these packages?

    If you want to restore all the Nuget package in your application, I suggest you could try to run below command in the Nuget Package Console.

    # Restore packages for a solution file
    nuget restore a.sln

    More details, you could refer to below article:

    https://docs.microsoft.com/en-us/nuget/tools/cli-ref-restore 

    https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore 

    Best Regards,

    Brando

    Tuesday, June 12, 2018 5:52 AM
  • User-1982615125 posted

    there is nothing wrong with my class libraries. they build fine.

    its just that instead op copying, VS litterally moves and removes the original copy on build. so the second build it cant find these .dll files anymore.

    Tuesday, June 12, 2018 4:13 PM
  • User475983607 posted

    there is nothing wrong with my class libraries. they build fine.

    its just that instead op copying, VS litterally moves and removes the original copy on build. so the second build it cant find these .dll files anymore.

    I don't have this experience with VS.  Is there anyway you can provide an example solution that exhibits this behavior?  Perhaps you create a build event that moves files?

    Tuesday, June 12, 2018 4:59 PM
  • User-1982615125 posted

    no its a fresh install

    Tuesday, June 12, 2018 5:47 PM
  • User283571144 posted

    Hi fazioliamboina,

    I also never face this issue.

    Cloud you please tell me which the VS version you have used?

    If possible, please provide a test application for us to test.

    Best Regards,

    Brando

    Friday, June 15, 2018 9:08 AM