locked
Git - clone to other computer leaves bin folder empty RRS feed

  • Question

  • User379720387 posted

    I have added a WebPages Razor C solution to Git, everything works fine.

    Then on another computer I have cloned the same project, everything is on the second computer except the bin folder.

    Solution does not build and I am dead in the water. Identical to my previous thread , nothing got fixed apparently.

    Rather than copy my bin folder across I would this time prefer to let visual studio do its thing and get whatever it needs.

    How do I trigger this action in Visual Studio 2017?

    Thursday, December 14, 2017 12:41 PM

Answers

  • User475983607 posted

    wavemaster

    Mostly Microsoft stuff. How do I trigger VS 2017 into getting what it needs?

    Again, Create a solution folder in the solution.  Place the required DLLs in the solution folder.  Add the DLLs to source control.  Add a reference to the DDLs in the solution folder.  Make sure the reference property is configured to copy the DLL to the bin. Build the project and the build process will copy the DLLs to the bin folder.  

    I use NuGet these days which solves this problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 14, 2017 2:03 PM
  • User475983607 posted

    I assume the problem you are trying to solve is that you copied the DLLs to the bin folder in the first place or you are targeting DLLs that were installed in a local system.  now you want the DLLs to move along with the project so that you don;t have to copy the DLLs every time you clone the project.

    Currently I have a bin folder on one device, is that what you call the solution folder?

    A solution folder is a folder in the solution.  

    "Place the required DLLs in the solution folder" - you mean copy them from one device to the other?

    Right click the solution in the Visual Studio solution explorer and "Add" a new folder.  Call it ExternalAssemblies.  Right click the solution file in solution explorer and select open folder in file explorer.  Add a new physical folder and give it the same name; ExternalAssemblies.  Copy the DLLs, using Windows Explorer, from your bin folder(s) to the new physical folder.  right click the solution folder and select"Add Existing".  Add the DLLs. 

    Now, remove the copied DLLs from the bin and create a reference to the DLLs in the solution folder.  Make sure the reference property is set to copy the DLL.  I think that is the default.  Now the assemblies will move with the project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 14, 2017 2:35 PM
  • User475983607 posted

    wavemaster

    Correct. The DLLs were installed locally on one device.

    If the project is referencing "Installed" assemblies then you should install the same assemblies on the system that will use the assemblies.  Otherwise, read the docs that come with the assemblies so you know what you need to copy or register on a new system.

    Keep in mind, this is not magic.  All you're doing is telling Visual Studio where to find the assemblies that the application needs.  You have to do this because of manually coping the DLLs to the bin folder in the first place.  Now you are on the hook to copy the files when using a source control client like GIT.  That is, unless you place the file in a location where Visual Studio can find the files.  Source control clients do not place files in the bin folder under source control by default because the contents of the bin folder changes for every build/run during development and the DLLs are made from of the source files anyway.  Since the source files are under source control, you can always go back to a previous state and do a build.

    wavemaster

    Created a reference for Elmah.dll but I am not seeing where I can set the reference property. Where is it? 

    Expand the references node in Solution Explorer.  Right click the reference in question and select "Properties".  Then find the property "Copy Local" and set it to true.  This will move the DLL to the output directory when the project is built.  Again, all you're doing is placing the "copied" DLLs in another folder under source control.  Then using the Visual Studio build process to copy the files to the bin. 

    You might want to look into NuGet to manage the packages.  

    wavemaster

    How can I undo the create reference thingy?

    Expand the references node in Solution Explorer.  Find the reference and press the delete button.  Before deleting, view the reference properties and make sure you actually need to delete the reference. 

    wavemaster

    And apparently it has made a change to my .sln, can I refuse to save the change until I understand what all is going on?

    Sure...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 14, 2017 6:56 PM

All replies

  • User475983607 posted

    Then on another computer I have cloned the same project, everything is on the second computer except the bin folder.

    That's correct.  It is uncommon to place binaries, which change often, under source control. 

    If the DLLs are 3rd party assemblies or assemblies that are not in the GAC then add a solution folder to your project and add the DLLs to the solution folder.  Add a reference to the DLLs in the solution folder.

    Thursday, December 14, 2017 12:56 PM
  • User379720387 posted

    DotNetOpenAuth

    Elmah

    EntityFramework

    iTextSharp

    Microsoft.Web.Infrastructure

    Microsoft.Web.WebPages.OAuth

    RestSharp

    System.Data.SqlServerCe

    System.Net.Http.xxxxx

    System.Web.xxxxxx

    WebMatrix.Data.xxxx

    etc.

    Mostly Microsoft stuff. How do I trigger VS 2017 into getting what it needs?

    Thursday, December 14, 2017 1:22 PM
  • User475983607 posted

    wavemaster

    Mostly Microsoft stuff. How do I trigger VS 2017 into getting what it needs?

    Again, Create a solution folder in the solution.  Place the required DLLs in the solution folder.  Add the DLLs to source control.  Add a reference to the DDLs in the solution folder.  Make sure the reference property is configured to copy the DLL to the bin. Build the project and the build process will copy the DLLs to the bin folder.  

    I use NuGet these days which solves this problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 14, 2017 2:03 PM
  • User379720387 posted

    I can see why the DLLs would not be placed under source control. So let's forget about Git for now to keep the discussion simple.

    Currently I have a bin folder on one device, is that what you call the solution folder? Or is it something entirely else?

    "Place the required DLLs in the solution folder" - you mean copy them from one device to the other?

    If so, that didn't work that well last time I tried that, see my old thread from the link.

    Can I conclude that VS2017 is not going to be of any help getting the DLLs I need?

    I use Nuget too. It didn't solve anything, it just sits there waiting for me to do something. What do I need to do so Nuget gets what is needed?

    Thursday, December 14, 2017 2:16 PM
  • User475983607 posted

    I assume the problem you are trying to solve is that you copied the DLLs to the bin folder in the first place or you are targeting DLLs that were installed in a local system.  now you want the DLLs to move along with the project so that you don;t have to copy the DLLs every time you clone the project.

    Currently I have a bin folder on one device, is that what you call the solution folder?

    A solution folder is a folder in the solution.  

    "Place the required DLLs in the solution folder" - you mean copy them from one device to the other?

    Right click the solution in the Visual Studio solution explorer and "Add" a new folder.  Call it ExternalAssemblies.  Right click the solution file in solution explorer and select open folder in file explorer.  Add a new physical folder and give it the same name; ExternalAssemblies.  Copy the DLLs, using Windows Explorer, from your bin folder(s) to the new physical folder.  right click the solution folder and select"Add Existing".  Add the DLLs. 

    Now, remove the copied DLLs from the bin and create a reference to the DLLs in the solution folder.  Make sure the reference property is set to copy the DLL.  I think that is the default.  Now the assemblies will move with the project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 14, 2017 2:35 PM
  • User379720387 posted

    Correct. The DLLs were installed locally on one device.

    If have not copied them to the other device because of bad experience last time I did this.

    There are only two devices in play, the developer's box (everything is working) and the tester's box (no bin files). 

    Started to implement your suggestion. 

    Created a reference for Elmah.dll but I am not seeing where I can set the reference property. Where is it? 

    Also, a new folder is created called Solution Items and it shows Elmah.dll and "Checked In"

    How can I undo the create reference thingy?

    And apparently it has made a change to my .sln, can I refuse to save the change until I understand what all is going on?

    Thursday, December 14, 2017 6:29 PM
  • User475983607 posted

    wavemaster

    Correct. The DLLs were installed locally on one device.

    If the project is referencing "Installed" assemblies then you should install the same assemblies on the system that will use the assemblies.  Otherwise, read the docs that come with the assemblies so you know what you need to copy or register on a new system.

    Keep in mind, this is not magic.  All you're doing is telling Visual Studio where to find the assemblies that the application needs.  You have to do this because of manually coping the DLLs to the bin folder in the first place.  Now you are on the hook to copy the files when using a source control client like GIT.  That is, unless you place the file in a location where Visual Studio can find the files.  Source control clients do not place files in the bin folder under source control by default because the contents of the bin folder changes for every build/run during development and the DLLs are made from of the source files anyway.  Since the source files are under source control, you can always go back to a previous state and do a build.

    wavemaster

    Created a reference for Elmah.dll but I am not seeing where I can set the reference property. Where is it? 

    Expand the references node in Solution Explorer.  Right click the reference in question and select "Properties".  Then find the property "Copy Local" and set it to true.  This will move the DLL to the output directory when the project is built.  Again, all you're doing is placing the "copied" DLLs in another folder under source control.  Then using the Visual Studio build process to copy the files to the bin. 

    You might want to look into NuGet to manage the packages.  

    wavemaster

    How can I undo the create reference thingy?

    Expand the references node in Solution Explorer.  Find the reference and press the delete button.  Before deleting, view the reference properties and make sure you actually need to delete the reference. 

    wavemaster

    And apparently it has made a change to my .sln, can I refuse to save the change until I understand what all is going on?

    Sure...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 14, 2017 6:56 PM
  • User379720387 posted

    There is no References folder in a Razor C Web Site.

    I will study your response tomorrow in more detail.

    Friday, December 15, 2017 3:15 AM
  • User475983607 posted

    There is no References folder in a Razor C Web Site.

    I will study your response tomorrow in more detail.

    I assume you are referring to a Razor Page application which most certainly has references although it is called dependencies and it works a bit differently.  You'll find Analyzers, NuGet, and SDK within the Dependencies node.  MS recommends that you use NuGet to manage packages in Razor Pages.  

    You can learn more about NuGet in the support docs.

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

    ASP Core and Razor pages support docs.

    https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages/?tabs=visual-studio

    Friday, December 15, 2017 12:04 PM