Visual Studio - could no resolve this reference - asp.net-mvc

I created an ASP.NET MVC project in Visual Studio 2012 on my laptop, did a bit of work on it without issues, then checked it into source control. I've checked it out on my main desktop machine (a completely fresh Git clone), and it won't compile stating that various references are missing (one of which being entityframework.dll). Looking back on my laptop, those DLLs are in my project's "bin" folder (which I didn't add to source control for obvious reasons). On my laptop, if I rename my bin folder, then I get the same compile errors. Am I incorrect in not committing certain DLL files that are in my bin folder? Surely those DLLs should be copied into the bin directory at compile time?

The desktop probably can't find the folder to copy from.
You should add the references using NuGet (if you aren't already) and include the packages folder in source control. (or enable package restore)

You should look as to where the library references are stored in your project file. If the project is referencing copies in your bin directory then you have your project setup incorrectly.
You should maintain a libraries directory in your source control tree that id checked in like any other dependency.
The bin directory should be output only.

Related

Importing a project into Visual Studio

I have a WinForms project with certain NuGet package dependencies that don't seem to be recognized even after using the NuGet restore option. I've received this project from a colleague and am trying to set it up so I can compile and work on it on my own machine.
Things I've tried:
Uninstalling and reinstalling Accord and OpenTK to no avail.
Adding references in the reference manager to everything that is giving me a warning and also listed in the reference manager (not all things issuing a warning are listed there). This resulted in additional warnings...
Updating the reference path to include the bin\debug directory of my project.
NuGet restore command in the package manager console. I had seen this references in a previous post while searching for solutions, but I guess these commands don't work on my installation?
Deleting the entire project and unzipping it again and praying it just works.
I had the same issue when I moved project files from a folder inside of the solution. Some reference file paths were still pointing to the old location and I went thgouth all the steps you did without solution.
The way I solved the issue is to manually edit (open in a text editor outside of VS2019) the paths in .sln and .csproj files. If you see any broken or wrong paths, do a search in files (I use grep) on the entire project directory.
Your colleague could have had paths specific to his environment left over in the project. I've seen this before numerous times.
Also, does your nuget console work with other projects?
This or this might help.

How to make TFS include bin and debug folders by default

I recently started working on a project that is using .Net Core & React. Our shop is using TFS for a version control and this is where I encountered a problem.
When React project is created it uses NPM that loads up a bunch of files in "node_modules" folder as dependencies. Some of these modules have "bin" and "debug" folders in them, but TFS naturally ignores them causing compilation issues for other developers.
Is there a way to add something like "!\ClientApp\node_modules*" to ".tfignore" file to eliminate this behavior on certain paths?
Remove all folders generated by package managers from source control entirely. Restoring packages should be part of your build process, both on your desktop and during CI.

References don't show up in Visual Studio 2017 after creating a .NET Standard branch

I'm working with Visual Studio 2017 on the open-source project https://github.com/SpiegelSoft/XamarinForms.Reactive.FSharp
I recently created a branch called dotnet-standard, which, as its name suggests, is a migration to .NET Standard. However, after creating this branch and checking back in to the master branch, which is a PCL rather than a .NET standard library, the project will no longer build.
First of all, the references are not visible. All I can see in Visual Studio is a .NET node (see screenshot).
The build fails in the first instance with
Xamarin.Forms targets have been imported multiple times. Please check your project file and remove the duplicate import(s).
This is odd because the same fsproj file was working before I created the new branch.
When I delete the Xamarin.Forms import line in my fsproj file and then perform a git reset --hard, the error message changes to
Your project is not referencing the ".NETPortable,Version=v4.5,Profile=Profile259" framework. Add a reference to ".NETPortable,Version=v4.5,Profile=Profile259" in the "frameworks" section of your project.json, and then re-run NuGet restore.
But the IDE won't even let me a a project.json file. Something has clearly gone very wrong with my Visual Studio settings.
Does anyone have any obvious tips before I reinstall Visual Studio?
As alluded in the comments, VS / MS Build can trip up on previously generated files - often in the various obj folders.
To get back to a ‘clean’ state (the same as when you first clone a repo), run git reset —hard to revert any uncommitted changes and git clean -xfd to remove any untracked files and folders.
Assuming your .gitignore file is configured correctly, this last step should remove all temporary files.

Issue with VS 2015 Project/Solution build definition in TFS 2010 Server

I'm getting an issue with TFS 2010 Build Definition which is not copying dlls properly for project in VS 2015. Initially I had an issue like all the compiler dlls are putting together in bin folder and I'm getting application level errors. Once I moved compiler dlls (csc.exe, .config,.CodeAnalysis.dll,...) Roslyn folder inside bin folder (Project\bin\Roslyn), application working successfully. My Roslyn folder is creating outside my project root directory.
Folder structure:
......\Build\Roslyn
......\Build\_PublishedWebsite\project_folder\bin
I have created a post build command to move this Roslyn inside bin and its moved successfully. but still a copy of files under Roslyn are available in bin too and its failing my application to work properly.
Any help. Please let me know if you need more info.
As a temporary fix,
I have added post build command to remove the files and it's working successfully.
if exist "$(WebProjectOutputDir)\bin\MicrosoftCodeAnalysisdll" del /F "$(WebProjectOutputDir)\bin\MicrosoftCodeAnalysisdll"

Installing Indy - which folders should be added to Delphi's Library list?

The directions on how to install Indy10 are (at least to me) a little vague in one place, and I'm hoping someone here can clarify a little.
The installation directions (From http://www.indyproject.org/sockets/Docs/Indy10Installation.en.aspx) state:
After Compiling
In your Indy directory you should now see some compiled .dcu files.
Open the IDE and go to the "Tools > Environment options > Select
Library" dialog tab. Now add the path to your files into the filepath
collection. Click Ok.
My Indy10 folder does not have any .dcu files in the root folder. It does have a bunch of DCU files in C:\code\Indy10\Output\DCU\Win32\Debug ... does this mean I should be adding C:\code\Indy10\Output\DCU\Win32\Debug to my library path? (And for that matter, should I be building Indy in Debug or Release mode, or does it matter?) Are there any other subfolders I need to add to the library path? Indy 10 has a much more complex folder structure than Indy 9 and I'm not convinced I've configured things "correctly".
Nearly every component package I install I touch the project options for the runtime package(s) to get a clean install.
Project Options
General Configuration
Output directory {componentpath}\lib\XE4\$(platform)\$(config)
Release Configuration
Output directory {componentpath}\lib\XE4\$(platform)
After that I compile the whole package for all target platforms in release and debug mode. Using a Build-Group is very useful to do that.
Now it is time to add the library paths (for each platform)
Library path {componentpath}\lib\XE4\$(platform)
Debug DCU path {componentpath}\lib\XE4\$(platform)\debug
Browse path all directories containing the source
In your own projects you can control which .dcu versions are used by setting the Use Debug-DCU option.

Resources