Visual Studio Team Services Build Issues - visual-studio

I am using Visual Studio Team Services as source control and have enabled continuous integration.
My project is an ASP.NET application which used Entity Framework 5. When i checkin the code and the build controller tries to build it, the following errors come up
DataModel\GenomicsTutorDataModel.Context.cs (40): The type or
namespace name 'DbSet' could not be found (are you missing a using
directive or an assembly reference?)
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets
(1578): Could not resolve this reference. Could not locate the
assembly "EntityFramework". Check to make sure the assembly exists on
disk. If this reference is required by your code, you may get
compilation errors.
In my solution i have made system.data.entity CopyLocal = True yet no success.
Any ideas?

May be you are on a 64 bits machine and the TFS server is not?
Try to build your project for Any CPU or x86.

Add the DLL you referenced for System.Data.Entity into a folder in your project or somewhere in a folder in the Source Control and reference to that one. Check this in and try to build your application again.

Related

TFS build unable to locate the project file and dlls

I am trying to run a newly created Build in TFS but i am getting an error that :
The project file "D:\Binaries\vsts-agent-win7-x64-2.105.7\_work\1\s\CompanyA.Solution\..\..\..\Users\ihalarnkar=\Documents\Visual Studio 2013\Projects\CompanyA.Project2\CompanyA.Project2\CompanyA.Project2.csproj" was not found.
Also some of the external dlls i am using for those i am getting no reference found. Like :
The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Does it mean i should have all the dlls i have referenced in the solution to be also installed on the tfs server?
How about the solution? Every new project added should be available on the physical drive on the tfs server?
This is the 1st time i am configuring and using DevOps for a SharePoint Provider Hosted app.
Kindly help.
You have a problem with your solution references -- the project reference looks to be for the path ..\..\..\Users\ihalarnkar=\Documents\Visual Studio 2013\Projects\CompanyA.Project2\CompanyA.Project2\CompanyA.Project2.csproj.
You'll need to go through your project files and fix the references.

Visual Studio Solution DLL error

I have a visual studio solution which works fine on one machine and when I copy the complete same solution to another machine it misses few external dlls.
Both the machine have same configuration and same version of visual studio.
I tried removing reference and adding again.I am able to reference the dll and use code but when I re-build,It gives the same error.Any pointers on what could have gone wrong?
The error message I get is as below
The type or namespace name 'NameSpaceName" could not be found (are you missing a using directive or an assembly reference?)
Also the warning shows.
The primary reference "NameSpaceName" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".
Both the machine have Visual Studio 2010 installed. It works on one and doesn't work on another machine
The reference you have added to the project is likely not in a subfolder of your project but referenced from the Global Assembly Cache (GAC). Since you probably didn't copy the GAC, this reference is now of a different version. Figure out which (3rd party ?) component is affected and install an older version of that component.
Typically, Visual Studio cannot target .NET 4.5, unless you applied a workaround. In that case, you can go to the project properties, Application and change Target Framework from 4.0 to 4.5.

Visual Studio Nuget dll not found in Release mode

I have a multi-project solution. In fact, some projects happen to be shared by 2 different solutions.
Anyhow, one of these is a test project and uses RhinoMocks. I used NUGET to add this to the project, and the solution is set to enable the download any packages from NUGET.
It builds just fine when in DEBUG mode, but when I put it into RELEASE mode, I get:
Error 1 The type or namespace name 'Rhino' could not be found (are you missing a using directive or an assembly reference?)
I don't think it's limited to RhinoMock, I've occassionally got it with NUNIT too.
Any ideas here?
Thanks

TFS 2010 Microsoft.Office.Interop Reference Woes

I'm about to go crazy with this problem!
I created a new server on a virtual
machine for TFS.
I have created a new Build
Definition, that when a solution is
checked in from my local machine TFS
is to build my solution using the
default build process template.
On the TFS machine and my local
machine I have MS Office 2010 and
.Net framework 4.0 Installed.
In my project I have a reference to
Microsoft.Office.Interop, etc...
This all build fine on my local
machine.
The problem occurs when the build definition is triggered. The build is run and does it's stuff for a while until it gets to the Microsoft assembly references.
The type or namespace name 'Office'
does not exist in the namespace
'Microsoft' (are you missing an
assembly reference?)
The type or namespace name
'Application' could not be found
(are you missing a using directive
or an assembly reference?)
ETC
The references paths point to the GAC, in case that matters.
Help would be awesome, and you would therefore be awesome by extension.
Regards,
Byron Cobb.
Byron,
If you take the assemblies from the compiled version on your computer create a libs folder at your solution level, then add the dlls for
Microsoft.Office.Interop.Word.dll
Microsoft.Office.Interop.Excel.dll
Microsoft.Vbe.Interop.dll
OFFICE.DLL
Into the libs folder, then remove the reference to your Office Interop and add references to the following assembies in you libs folder, should work a treat, we build without office on our build server.
Regards
Iain

How do I use Fluent NHibernate with .NET 4.0?

I want to learn to use Fluent NHibernate, and I'm working in VS2010 Beta2, compiling against .NET 4, but I'm experiencing some problems.
Summary
My main problem (at the moment) is that the namespace FluentNHibernate isn't available even though I've imported all the .dll assemblies mentioned in this guide.
This is what I've done:
1. I downloaded the Fluent NHibernate source from here, extracted the .zip and opened the solution in VS. A dialog asked me if I wanted to convert the solution to a VS2010 solution, so I did.
2. I then went into each project's properties and configured all of them to compile for .NET 4, and built the entire solution.
3. I copied all the .dll files from /bin/Debug/ in the FluentNHibernate to a new folder on my local hard drive.
4. In my example project, I referenced FluentNHibernate.dll and NHibernate.dll from the new folder.
This is my problem:
If I right-click on FluentNHibernate in the References list and select "View in Object Browser...", it shows up correctly.
Now, when I try to create a mapping class, I can't import FluentNHibernate. This code:
using FluentNHibernate.Mapping;
namespace FluentNHExample.Mappings
{
}
generates an error on the using statement, saying
The type or namespace 'FluentNHibernate' could not be found (are you missing a using directive or an assembly reference?).
The FluentNHibernate assembly is still in the list of References of my project, but if I try to browse the assembly in Object Browser again, it can't be found.
What is causing this?
I also had similar problem.
"Error List" window displayed:
The type or namespace name 'FluentNHibernate' could not be found (are you missing a using directive or an assembly reference?)
But "Output" window was displaying detailed information:
warning MSB3253: The referenced assembly "FluentNHibernate" could not be resolved because it has a dependency on "System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
In my case; I had created a console application project which was targeting ".Net Framework 4 Client Profile" by default, so changing to ".Net Framework 4" fixed issue for me.
I'm unable to observe this behavior in my build, could it be related to this problem: Weird override problem with Fluent NHibernate and .NET 4
If so you could try http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/ae4013d711d2e4ad as a potential fix.
Isn't there a better way to fix this problem?
I don't want to reference System.Data.OracleClient. So I shouldn't have to target the full .Net framework if I don't even want that reference.
Can't I target the Client Profile of the .Net framework, but add a compiler warning exception somewhere so that it just skips that warning? I know it won't cause a runtime problem because I don't use Oracle.
I get identical problem which says there's also a dependency on System.Web. Same story, this is for a Windows WPF app, so I don't need System.Web. Can't I just target the Client Profile and somehow convince the compiler to keep going?
Thanks,
Hugh
EDIT: I figured this out! I had to compile NHibernate myself though. Opened the 2.1.2 code in Visual Studio and deleted everything that says "Oracle" or "System.Web" and I ended up getting it to build. I do not have to target the full .Net Framework now.
We had this issue and the issue went away if we removed the obj and bin folder from the project which was referencing the NHibernate using project.
So we have 'project1' which uses NHibernate to produce project1.dll.
'project2' references project1.dll.
Problem resolved if we removed the obj/bin folder from project2.
Can't say why, but our solution now compiles fine.
Mike.

Resources