I have a c# solution with some projects. For the solution I have created a folder for extenal libs. I have copied some Telerik-dll's from the instalation to the libs folder.
Now my problem:
When I add the dll's to the projectes (I choose the copied dll's from the libs folder) Visual Studio takes always the dll's of the installation source and not the dll's of my libs folder.
How can I fix this? I'm afraid that my colleagues could not compile the solution because the dll's are referenced to a missing directory (would happen if they don't have installed the correct Telerik version).
Thanks
Edit:
For example:
I reference with the file chooser
"C:\vendors\Libs\Telerik.Windows.Controls.Input.dll"
Visual Studio references
"C:\Program Files (x86)\Telerik\RadControls for Silverlight Q2 2011\Binaries\Silverlight\Telerik.Windows.Controls.Input.dll"
Properties of the references - set Embed Interop Type to false and set Copy Local to true
Related
I would like to have a smooth and efficient installation of the solution, but what I "inherited" is very far from that, and the guy who programmed most of it has left the company.
At present I am trying to install it on a test-server, and not all the dll's land in the correct places after the installation.
Firstly, if I use log4net in a project, then I need the log4net.dll in the folder after the installation (I guess). How do I get the log4net.dll to be copied with the project dll?
Secondly, Project A expects Project C's dll to be in the GAC or so it seems when I debug in Visual Studio and check where the modules are loaded from.
I also see that this is entered in the post build event commandline of Project A:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\GacUtil.exe" -i "$(TargetPath)"
copy "$(TargetPath)" "C:\Program Files\MySolution\bin"
So how do I get Project C's dll into the GAC by way of the installation? I get an error on the Test Server because it can't load C.dll.
UPDATE WITH MORE DETAIL
After the solution has been installed with Windows Installer, a few folders are created in the parent folder such as Apps, bin, Engines, Service etc.
In the Apps folder, I have A.exe, which is looking for C.dll. However, C.dll lands up in the bin folder. As mentioned above, during execution of A.exe, it actually loads the modules of C.dll from the GAC (and on my laptop, those files are in the GAC because of the post-build event command line specified in the properties of Project C, but not in the GAC of the Test Server to which I am trying to install this solution).
So yes, I assume I could run something like this:
gacutil -i C.dll
after the installation, but it doesn't seem right.
There are two parts to your question relating to the GAC, and ensuring DLLs are copied.
GAC
Check out this link (https://msdn.microsoft.com/en-us/library/dkkx7f79%28v=vs.110%29.aspx) from MSDN on how to install into the GAC. The key thing is it must be strongly named or it will fail.
DDLs
Depending on how you are referencing Log4Net, there are a few ways to do this.
If you can add a reference in your project, make sure the property CopyLocal is set to true
If you just have the file locally, you can add it to a sub folder of your project with a symbolic link (https://support.microsoft.com/en-us/kb/306234), and then set the CopyToOutputDirectory property.
Hopefully these help you along.
I found what I was looking for!
Select the Setup project, then go to the menu "View" -> Editor -> File System.
It seems you can specify where the dlls must go, and what should be copied to the GAC during installation.
I've got a project on a computer with installed devexpress line for win forms. In VS2010 I add references to some of devexpress .dll(s) and mark those references as 'Copy Local' and build project. Than I send a folder with a project to another user whose machine has not installed devexpress on it. When he opens the solution all devexpress references are shown as broken and the assembly won't compile.
The output is as the following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5):
warning MSB3245: Could not resolve this reference. Could not locate the assembly
"DevExpress.Data.v13.1, Version=13.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a".
Check to make sure the assembly exists on disk.
If this reference is required by your code, you may get compilation errors.
How to add references to the assembly correctly so as I can open it on a machine with no such .dll(s) installed?
"Copy Local" option is copying files to the published directories after building process.
You can include these dlls in the separated solution folder, reference VisualStudio to them and commit this folder with solution to svn or tfs.
In order to do that you need to add the references via Add Reference... / Browse. In the csproj file for your project you should have something like:
<Reference Include="Name.Of.Assembly">
<HintPath>Relative\Path\ToAssemblyFile.dll</HintPath>
</Reference>
BUT VisualStudio tries to be smart and adds the Reference to the installed assemblies, even if you choose Browse... to add them.
You can either:
Not install the DevExpress package and only copy the DLLs to your development machine
Manually edit the .csproj file
Either way, you need to keep the DLLs somewhere. I usually put them under source control.
To achieve this, you should add the DevExpress (or other third-party) assemblies to a folder under your solution root directory, then reference the assemblies in this folder rather than referencing the DevExpress install directory.
You should also add the third-party assemblies to source control, so they're available to all developers.
If the other developer hasn't installed a DevExpress license, it will still build, but will display a nag screen at runtime.
My colleague saved a visual studio C# express project on a dropbox folder and I opened it from this folder. We addded the reference paths but some namespaces are still not recognized. What should we do and is it possible to work together from dropbox on the project?
The way that we have resolved this is to include all external, non-framework assemblies required by the application in sub-folder relative to the project and then when the assemblies are referenced, we edit the csproj file and ensure that the assembly references are relative instead of absolute.
For example:
Solution Folder
Assemblies
MyAssembly.dll
Project Folder
MyProject.csproj
MyProject.sln
If MyProject.csproj has a reference to MyAssembly.dll, then the reference in the csproj will be something like:
<Reference Include="MyAssembly">
<HintPath>..\Assemblies\MyAssembly.dll</HintPath>
</Reference>
This practice ensures that all projects are always built and tested with the exact same set of DLLs and are not influenced by different updates installed on each developer's machine.
I used to add my ASP.NET dependencies added as a 'Reference' in my project, and also added them manually to the '/bin' folder. This seemed a bit redundant, as so I removed everything from the bin folder. The project compiled and runs, but VS2010 started to act funny now. It doesn't recognized a lot of my controls (eg. Telerik UI) and therefore a lot of HTML is underlined as an error. So is this because I really need to add my files as both dependencies and into /bin, or a different problem?
Try to make a complete rebuild for your sollution.
Select properties on the referenced assemblies and check "copy local". This will copy the files to the /bin folder on compile.
Assemblies installed in the GAC will not need to be copied to the bin folder though. If you plan to deploy your solution to another machine, consider what assemblies are on your development machines GAC but not on the live/deployed server (and then either install them to the GAC on the live server or have vs copy to the bin by selecting copy local)
How do you determine what executable and DLL’s a C# Visual Studio project produces?
In Visual Studio 2010, where do you go to see what the name of the executable that a project produces.
A C# project will produce just one assembly output (DLL or EXE). Additional assemblies will be included from references that are not installed in the GAC. For instance, if you add a reference to another project in the solution, it will copy that project's output assembly to the current project's bin folder.
Check the bin folder after build to see what was generated and included. e.g. <project folder>/bin/Debug
I think it's the <AssemblyName> section in the .csproj file. Combined with the <OutputType> section to determine the file extension.