How to move and build Asp.net project to other computer? - asp.net

I developed a website using VS2012, Asp.net MVC4 and entity framework in old computer.
and I copied the project to new computer, in VS2015 project folder, and try to run it. but there are many warning sign in reference.
I don't know what the warning sign means..
How can I solve that problem? so that I can build the project in new computer?
[Edited]
I did, 'Update-Package -Reinstall', and I found still some of reference are still with warning sign. and the package path was pointed to bin directory.
So I copied the bin directory then,
and,
How should I do to solve this problem?

You should look on the old computer where are those references coming from. Whether they are added as NuGet packages or directly referenced from some lib folder which you forgot to copy. On the old computer click on the assembly reference and open the properties window (F4) which will show the physical path to the assembly. On the new computer you should replicate the same folder structure so that the assemblies can be resolved. Alternatively you may take a look at the corresponding .csproj file.
If they were added as NuGet packages, then you should restore them using the following command:
Update-Package -Reinstall
This will look for a packages.config file in all projects in the current solution and download and install the NuGet packages listed there.

Related

System.Net.Http.Formatting missing in some machines(xml) but works in other (dll)

The best way to include System.Net.Http.Formatting might be through nuget. But when a developer sees it in the default Assemblies section in reference manager then they just add it, expecting all developers to have it installed by default. But to our surprise, some developer machines did not have this dll.
All developers have the correct folder where this dlls is found
"C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\"
Some developers just have XML files and others have dlls in it, even though the file names are the same.
Why are dlls missing in some machines?
Sometimes it is really an issue while finding the missing dlls. Better approach is to clean the nuget cache and folder both and restoring nuget packages again would resolve this issue.
System.Net.Http.Formatting mystery resolved
System.Net.Http.Formatting won't be installed by default along with asp.net. If it appeared in one developer machine, then it could be because some other projects in the VS might have used a nuget to pull it in. This developer without knowing this gives a manual reference to this dll in a new/different project. To him/her everything works fine.
When another/new developer comes and tries to do the same in his/her machine, before reaching this particular project(which pulled in System.Net.Http.Formatting through nuget), the developer gets error(from the manually entered dll project by the previous developer mentioned above). That explains why the dll is missing in his/her machine.
But why is XML file present then?
Becuase the package folder was stored in tfs/git from the first developer machine(who successfully had the dll through nuget). And tfs/git ignored the dll when checked-in.

Could not load file or assembly "Umbraco.ModelsBuilder" or one of its dependencies. The system cannot find the file specified

I have a problem with Umbraco backoffice when my site is online.
I published my site with Visual Studio 2015 and it works fine, but when i try to open the Umbraco backoffice i get an error that says
Could not load file or assembly "Umbraco.ModelsBuilder" or one of its dependencies. The system cannot find the file specified
but, in the folder bin the dll exists. When i test the project in local it works perfectly.
Could anyone give me some advices?
Thanks
Try deleting all files and folders under /bin/* on your remote installation.
Then in Visual Studio Rebuild Solution and Publish again.
Additionally when anything in Umbraco doesn't work, always first delete the whole /TEMP folder under /App_Data and restart Umbraco.
It could be one of the other dependencies missing. Compare what's in your /bin/ folder locally with what's on the live site's /bin/ folder and see if there's any DLLs missing. If they're not the same, copy up the missing files and see if that sorts out the problem for you.

Is Entity Framework 'Packages' folder needed for production?

I have a webforms projects with entity framework 5 and .NET 4.5. When I'm publishing the the web site it generates 'packages' directory in the compiled code, with some entity framework dll's in it. However the website functions well even If I remove it. It should be mentioned that I don't use code-first.
What is the purpose of this folder?
TIA.
First, make sure you're using EF5, as version 5.0, not the 4.4 that may happen if you first installed the EF5 on .net 4 and updated to .net 4.5 later.
http://thedatafarm.com/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/
From EF5 on, entity framework is a separate api(package) that can be installed via Library Package Manager or NuGet from Visual Studio, it is not part of .net framework installation any more.
packages folder is a default one for NuGet package installation.
So, please have a look at the EntityFramework reference that must be present in your project where you actually work with EF, and see the version and the location of assembly you are referencing. If your Copy Local property is set to true, you don't need to include packages folder in your installation package, assembly will be copied to bin folder automatically, otherwise you'll have to.
The short answer to your question is : No, you don't need the packages folder
Long answer : No, you don't need the packages folder in production, its created by nuget when you install a package to hold the dlls for that package.
So if you include EF in your project it will be copied in there and a reference will be added to your project to ~/packages/Entityframework.dll, at compile time a copy of the dll will be put in your bin folder.
During releases to our live environment I routinely remove this folder as its not needed.

NuGet packages and the bin folder in ASP.NET Web Pages site

This is probably a very basic question but what's the mechanism for DLLs under the packages folder to get copied into the bin folder?
As an example, I have a solution that contains a single "project" (node) of type Web Site (i.e., no csproj, just file-system-based). It is a very basic static website. I want to add ASP.NET Web Pages support so I install this NuGet package and now there are some DLLs under the packages folder and my web.config has been updated. However, when I run the site, it shows YSOD with the error "Could not determine which version of ASP.NET Web Pages to use" which I guess is because there is no bin folder with DLLs in it (when I create a "Razor" site from scratch in Visual Studio, the bin folder is there). If I try to rebuild the solution, it fails with the same error which is compilation error (not runtime error) this time.
What's the command or mechanism to restore the bin folder from the packages folder? I don't want to have DLLs in my source control and according to NuGet docs, it seems that this workflow is very much supported. I guess that if it were csproj-based project, there would be some MS Build action or something like that to use the DLLs from the packages folder but this is a website and I cannot define advanced build actions, can I?
Using Visual Studio 2013, when I install a NuGet package, such as Microsoft.AspNet.Razor, into an ASP.NET web pages application then the bin folder is created.
Getting the binaries into the bin folder is part of the build process and it is not done by NuGet. NuGet can be used to restore the files into the packages folder but will not do anything with your bin folder when restoring.
For building and package restore to work it looks like you need to keep the bin folder and any .refresh files. You can remove the other binaries from your version control system.
System.Web.Razor.dll.refresh
The contents of this file tells Visual Studio where to find the NuGet packages:
..\..\Projects\MyWebSite\packages\Microsoft.AspNet.Razor.3.1.2\lib\net45\System.Web.Razor.dll
To test this, I deleted all the binaries from the bin folder, removed the packages folder, and then rebuilt the project. Visual Studio restores the packages and when building copies the required assemblies to the project's bin folder.

QT Dlls problem

I have small problem with qt dlls. In visual studio 2008 project compile fine and everything works, but when I try to open application in debug folder without using visual I had errors, so I copy all needed dlls to this project, but after that I don't have any error, and nothing happens (window doesn't appear on screen).
In visual studio you can add a binary reference to the Qt dll's and it will ensure they get copied to your build directory when you debug. You need to might use a dependency walker to figure out what all the required dll's are.
You need to also copy from your Qt install folder the "platform" dll located at : platform\qwindows.dll
to your running folder.
(I forget if you need to copy "platform\windows.dll" or just "windows.dll")
You can also use the cygwin toolkit to resolve dependencies as well (ldd). Another option is to add the library path to your %PATH% environment variable

Resources