installing specflow for vs2013 mssing TechTalk.SpecFlow reference - specflow

I installed Specflow using the Download button
from the VS2013 specflow page
I added a feature to my Specs project using Add New Item and Choosing SpecFlow Feature File
When I build the project I get
Error 1 The type or namespace name 'TechTalk' could not be found (are you missing a using directive or an assembly reference?)
I also get an error mentioning that NUnit is missing.
Where would I find the files to reference and how do I check they are correct to go with TechTalk.Specflow 1.9.3.0 ?

Go to visual studio package manager console.
To install specflow for NUnit, type
Install-Package SpecFlow.NUnit
This will install all the required packages and a correctly configured app.config to work with NUnit.
If you instead resolved all the references by hand, then you would still have to construct the app config correctly. Finding the right config for MSTest or NUnit can take a little while to get right so it is better to just use the nuget package.

Related

Error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) in TFS build

I have updated our ASP.NET Web API solution to include the Microsoft.Azure.NotificationHubs Nuget package as I want to be able to send push notifications to our mobile clients. I have written a new controller that does this. Everything works fine.
When I check-in the code changes to our on-premise TFS build server I am getting the error:
Error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
I have updated the build server to the latest VS2017 build tools but am still getting the error. I can't determine if this is an MSBUILD or VS error.
I am using Visual Studio 2017 15.9.4. The project uses .NET Framework 4.6.1.
UPDATE
After some further investigation I can see that the TFS build server is NOT restoring the Nuget package for Microsoft.Azure.NotificationHubs but restores all the other Nuget packages. So the problem seems to be due to the Nuget package not being restored during the build
Here is a screenshot showing that the package.config correctly references the nuget package. But for some reason this nuget package is NOT getting restored during the build.
I've eventually managed to fix this by adding a commandline nuget restore task to the build pipeline.
NuGet.exe restore MySolution.sln
I resolved it by uninstalling and installing the nuget package back again.

Build failure - Restore package option not working in Visual Studio Team Services (was VS Online)

I am using a TFS Git project in Team Services and while my project compiles locally, I get a build failure when I check in my code to VS online and manually queue the build.
The errors at the moment are only pertaining to enterprise library data access dlls. I am using V6 of the library and this is error I get
The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
In my build definition I have checked the box against both Restore Nuget Packages and when that alone did not work, I checked the box against [Clean] as well. I still get that error. My packages.config files are checked in for each of the projects in the solution. I also have the Packages folder checked in but this folder has no dlls. It only has the various .nupkg files and respective .xml files checked in. Is this causing the problem?
Yes, you have to either checkin the DLLs or delete the nupkg files. The build server thinks you already have the packages so its not trying to restore them but the DLLs aren't there to reference.

How to fix namespace issues after TFS check-ins?

In setting up a solution for multiple developers, after checking in then checking out on another system, I consistently get the following error:
The type or namespace name 'OData' does not exist in the namespace
'System.Web.Http' (are you missing an assembly reference?)
Without checking in the bin folder, how can this be resolved on the working dev machine?
I found that the System.Web.Http.OData namespace is from Microsoft.AspNet.WebApi.OData which you can install from NuGet. So, to correct your current issue, right click the MVC project on that machine, select Manage NuGet Package, find Microsoft.AspNet.WebApi.OData to install it.
You can get visual studio to download the Nuget packages when you do a build locally, you can enable this through
Tools > NuGet Package Manager >Package Manager Settings
That way you're packages are not added to TFS and anything that your colleagues add to the solution will be automatically downloaded when you rebuild the code, when you first check out from source control

How to resolve reference errors in Code Analysis of MVC.net project using Team City

When using Team City for CI builds there is an option to use the Resharper command line tools to run Code Analysis inspection of the code as one of the build steps.
I have this working with reference library projects but the mvc.net project in the solution fails with reference errors:
One or more types required to compile a dynamic expression cannot be
found. Are you missing references to Microsoft.CSharp.dll and
System.Core.dll?
Even with the default Microsoft template there are over 200 errors and they seem to all come from the razor views. (The project compiles and deploys from the build server correctly and FXCop also runs successfully, this seems to be an issue just for resharper tool.)
I can run the resharper code inspection in visual studio without errors.
In Team City I just have a default Inspection (.NET) build running pointing at the .sln file.
We are using Resharper Command Line Tools 9.1.201 as provided with TeamCity 9.0.4
What configuration or additional steps can I take to get the resharper command line tool to resolve mvc view references on the build server?
If resolving the references is not possible, can the razor views be excluded from the analysis without needing to add each exclusion to the command line?
For future reference, I just had the same issue. Digging through the build log, I noticed a seemingly unrelated warning:
The reference assemblies for framework ".NETFramework,Version=v4.5.2" were not found.
I retargeted my project to .NET 4.6 and installed the .NET 4.6 targeting pack, and the code inspection errors are gone. Unfortunately, I don't know if just installing the .NET 4.5.2 targeting pack would have solved the issue.

Assembly references missing errors while building solution on TFS 2013

i have a solution which contains 3 projects (DAL,BLL and Utility) and one website.
I tried to build solution locally but it was giving some missing references errors. i added missing dll's and build was success locally.
i checked in whole solution to TFS 2013 server. and tried to build solution on tfs through build definition. Butbuild fails with many errors (missing assembly reference).
in source control i cant see any bin file so that i can add dlls.
What am i missing? how can i add referenced to a project on TFS?
You should not check binaries into any source control system.
If your referenced assemblies are available on Nuget then use nuget to reference them correctly.
If your referenced assemblies are not on Nuget them you should package them as a Nuget package, stick it on a fileshare (or better yet MyGet), and take a reference on that Nuget package.
The question is irrelevant, the answer is nuget 😊

Resources