How to fix “missing an NUnit assembly reference?” error when using SpecFlow - visual-studio

I am new to SpecFlow. I had installed the required NuGet packages for SpecFlow and NUnit. When I had clicked on Build, Visual Studio 2017 is throwing the below errors:
"Error CS0234 The type or namespace name 'TestFixtureTearDownAttribute' does not exist in the namespace 'NUnit.Framework' (are you missing an assembly reference?)"
"Error CS0234 The type or namespace name 'TestFixtureTearDownAttributeAttribute' does not exist in the namespace 'NUnit.Framework' (are you missing an assembly reference?)"
I had installed all the SpecFlow and NUnit 3 related NuGet Packages and Extensions but the error won't go away.
Please Refer the Screenshots for more info.
Thanks in advance for your help.

Related

error CS0234 The type or namespace name 'Transactions' does not exist in the namespace 'System' (are you missing an assembly reference?)

I just upgraded from VS2015 to VS2017 Professional and my solution which was building fine on VS2015 is now failing to build on VS2017 with the following error:
error CS0234: The type or namespace name 'Transactions' does not exist in the namespace 'System' (are you missing an assembly reference?)
Looking at the reference for System.Transactions, it is pointing to the right location
<Reference Include="System.Transactions">
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll</HintPath>
</Reference>
Has anyone solved this issue?
In my case, the issue was with the relative path to referenced assembly. By removing the HintPath, I am now able to build the solution.
............\Windows\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll
Procedure:
1. Right-click and Unload Project
2. Edit "Project name"
3. In the XML document, locate the HintPath for the assembly in questions and remove it.
4. Ensure that the HTML tag "Reference" for that assembly is properly closed.
5. Reload project and build.

Debugging Web Project w/ Visual Studio Code + ASP.NET 5 + Mono + Kestrel + OS X

I'm pretty new to OS X (4 days with my new mac), and I am working on setting up an environment where I can debug my Asp.Net 5 web project locally with the debugger built into Visual Studio Code, specifically getting the breakpoint to work when attaching to mono.
I followed these instructions for installing asp.net 5 and visual studio code. (http://docs.asp.net/en/latest/getting-started/installing-on-mac.html)
I then installed yeoman, and scaffolded out an aspnet project.
I ran commands dnu restore, dnu build, and dnx web.
The project runs locally on Kestrel at localhost:5000 just fine. I can also attach it to mono via the VS Code debugger.
The issue arises when I try to set breakpoints in the C# code. The debugger will not hit them.
After doing some research I found that I needed to specify the Startup.cs file to mono as the one to debug. (https://code.visualstudio.com/Docs/editor/debugging)
But after running mcs -debug Startup.cs, I get these errors:
Startup.cs(5,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(6,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(7,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(8,17): error CS0234: The type or namespace name `Data' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(9,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(10,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(11,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(12,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(13,16): error CS0234: The type or namespace name `Models' does not exist in the namespace `palmtree'. Are you missing an assembly reference?
Startup.cs(14,16): error CS0234: The type or namespace name `Services' does not exist in the namespace `palmtree'. Are you missing an assembly reference?
Startup.cs(20,24): error CS0246: The type or namespace name `IHostingEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(20,49): error CS0246: The type or namespace name `IApplicationEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(39,16): error CS0246: The type or namespace name `IConfigurationRoot' could not be found. Are you missing an assembly reference?
Startup.cs(42,39): error CS0246: The type or namespace name `IServiceCollection' could not be found. Are you missing an assembly reference?
Startup.cs(62,31): error CS0246: The type or namespace name `IApplicationBuilder' could not be found. Are you missing an assembly reference?
Startup.cs(62,56): error CS0246: The type or namespace name `IHostingEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(62,81): error CS0246: The type or namespace name `ILoggerFactory' could not be found. Are you missing an assembly reference?
It looks like mono cannot debug compile the Startup.cs properly. Is anyone else getting this error when trying to set up debugging? Or does anyone have breakpoints working with mono, asp.net 5, kestrel, vs code, and OS X?
Debugging Visual Studio Code and ASP.NET 5 are in preview and at this
time debugging ASP.NET 5 is not supported in Visual Studio Code (on
any platform). Rest assured, we are working hard to bring these
experiences to you in the near future.
Ref: https://code.visualstudio.com/docs/runtimes/ASPnet5
The Mono section that you are referring to is for compiling and attaching to a mono/.Net program (not an dnx ASP.NET-based one). ASP.NET 5 applications are compiled using the Roslyn compiler, not Mono's mcs.
Debugging a Mono Application Example:
Create a directory, cd into it and type code . to start VSCode using that directory.
mkdir monoconsoletest
cd monoconsoletest
code .
Create a new file in VSCode
Name it program.cs
Enter the following code into the editor:
using System;
namespace consoleViaVSCode
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello VSCode!");
}
}
}
You could compile and run this in a shell, but let create a tasks.json file so we can do it via the Command Palette.
Create a tasks.json file:
The next step is to set up the task configuration. To do this open the Command Palette with F1 and type in Configure Task Runner, press Enter to select it.
This will create a sample tasks.json file in the .vscode folder. The initial file has a large number of examples within it. Highlight it all, delete it and add:
{
"version": "0.1.0",
"command": "mcs",
"isShellCommand": true,
"showOutput": "silent",
"args": ["-debug", "program.cs"]
}
Now you have one task that you can execute via task mcs down the Command Palette and this task will build your program.cs using Mono's mcs compiler with the '-debug' option that will create a program.exe.mdb file that has the debugging symbols for the program.exe application.
So execute that task and if you have no errors, a program.exe and program.exe.mdb` will show up in the file pane:
If you have any errors, they will show up in the Output pane (right of the source code pane).
Now lets add a task to run your program with mono .Net runtime with the options for it to wait for a debugger to attach.
Note: I would show you a mono debugger task but running a shell process like that is broken in VSC 0.10.1. and you would be to wrap it in a glup routine... :-/ so...
In the process.cs, set a break point on the Console.Write.... line:
From the shell that you started VSCode from:
mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:5858 program.exe
Back in VSCode:
Click the Bug Icon and than the Config\Gear Icon and select "C# mono" to generate the default "attach" configuration. Select "Attach" and click green Start button:
And you will hit your breakpoint:

MSBuild VS build from inside the visual studio

I'm running a msbuild batch command in order to build my solution and i'm getting: error CS0246: The type or namespace name '******' could not be found (are you missing a using directive or an assembly reference?)
This is the batch command:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe %~dp0****.sln /t:clean /t:reBuild /v:d /m:4 /p:Configuration=Debug /p:Platform="x86"
But when i'm running a build for the same solution from within the visual studio everything works fine.
I checked project dependencies and everything looks fine, the same problem happens when i'm running TFS build with the build definition I had built for this solution.
I'm building with Visual Studio 2013.
Any idea?
Apparently by removing the parameter /p:Platform="x86" the problem was solved, I have no idea why it crashed the build, might be because the solution configuration was already on x86.. could be a bug in MSBuild?

owin Identity in visual studio 2013

var authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
im using vs2013 and this line of code isnt working
it says
Error 1 'System.Security.Principal.IPrincipal' does not contain a definition for 'GetOwinContext' and no extension method 'GetOwinContext' accepting a first argument of type 'System.Security.Principal.IPrincipal' could be found (are you missing a using directive or an assembly reference?)
The AuthenticationManager class resolves to System.Net namespace
I just created an entire tutorial on adding this from Visual Studio 2012 at httpJunkie.com But yes, You need Microsoft.Owin.Host.SystemWeb and it can be found at NuGet.Org
https://www.nuget.org/packages/Microsoft.Owin.Host.SystemWeb/2.0.2
Or installed via package Manager Console:
PM> Install-Package Microsoft.Owin.Host.SystemWeb

.net 4.5 not working with VS2010, INotifyDataErrorInfo not found

I installed the .net 4.5 framework, but Visual Studio gives the following error
error CS0246: The type or namespace name 'INotifyDataErrorInfo' could not be found (are you missing a using directive or an assembly reference?)
I modified the project reference paths to the following
C:\Program Files\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\
C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\
but then I get the error
error MC1000: Unknown build error, 'Could not load type 'System.ComponentModel.TypeConverter' from assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Has anyone encountered or resolved this issue before?
Since .NET 4.5 is still in beta, I think it's only officially supported in the VS11 Developer Preview, not in VS2010.

Resources