running dotnet test on NUnit project generates cs1061 on referenced WPF project - c#

I need to run this in an automated AWS environment, so I need to do everything via command line. As it stands, the unit tests will run fine so long as I run them in Visual Studio, but when I try running via "dotnet test" I get the following error on the WPF project that is indirectly referenced.
Here is a sample log of the errors (I removed specifics)
\MainWindow.xaml.cs(29,13): error CS0103: The name 'InitializeComponent' does not exist in the current context [\MyProject\MyControl.csproj] \MainWindow.xaml.cs(43,18): error CS1061: 'MainWindow' does not contain a definition for 'MyPanel' and no accessible extension method 'MyPanel' accepting a first argument of type 'MainWindow' could be found (are you missing a using directive or an assembly reference?) [\MyProject\MyControl.csproj]
I ran: dotnet test -t from the project. I was expecting a list of the tests, and got the error message instead.

Related

What Nuget Package do I need for WinApplication.GetSecurityStrategy().RegisterXPOAdapterProviders();?

I created a new Winforms Xaf Xpo standard security project with 21.2/5
Then I changed the framework of each project to be 4.7.2
Then I ran the upgrade wizard.
Then I tried to convert the project files to use Nuget with Package References.
However I get the following build errors
Severity Code Description Project File Line Suppression State
Error CS1061 'SecurityStrategy' does not contain a definition for 'RegisterXPOAdapterProviders' and no accessible extension method 'RegisterXPOAdapterProviders' accepting a first argument of type 'SecurityStrategy' could be found (are you missing a using directive or an assembly reference?) DXXpo.Win C:\Users\kirst\source\repos\DXXpo\DXXpo.Win\Program.cs 33 Active
Error CS0246 The type or namespace name 'SecuredObjectSpaceProvider' could not be found (are you missing a using directive or an assembly reference?) DXXpo.Win C:\Users\kirst\source\repos\DXXpo\DXXpo.Win\WinApplication.cs 20 Active
I tried drilling into another new project and I can see that RegisterXPOAdapterProviders has namespace DevExpress.ExpressApp.Security
I already have that installed as a NugetPackage.
I tried installing DevExpress.ExpressApp.Security.Xpo but I get a message
Severity Code Description Project File Line Suppression State
Error NU1101 Unable to find package DevExpress.ExpressApp.Persistent.Base. No packages exist with this id in source(s): DevExpressMy, nuget.org, SBDCommonFeed#Local DXXpo.Win C:\Users\kirst\source\repos\DXXpo\DXXpo.Win\DXXpo.Win.csproj 1
There are no packages starting with DevExpress.ExpressApp.Persistent in the feed.
The docs are here
This question is possibly related.
I managed to resolve this issue by including the package DevExpress.ExpressApp.Security.Xpo

Unable to build Uno Platform UWP template project

Decided to experiment with the Uno Platform, so I followed the instructions here: https://platform.uno/docs/articles/get-started.html
Set up a new solution in VS2019 16.6.4 using the Cross-Platform App (Uno Platform) template, then updated all the NuGet packages.
Without changing a line of code, I'm unable to build the solution (or just the UWP project). With UWP/x86 selected, I get these two build errors:
Error CS1929 'ILoggerFactory' does not contain a definition for
'AddConsole' and the best extension method overload
'ConsoleLoggerExtensions.AddConsole(ILoggingBuilder,
Action)' requires a receiver of type
'ILoggingBuilder' [PROJECT].Droid, [PROJECT].UWP, [PROJECT].Wasm,
[PROJECT].iOS,
[PROJECT].macOS [PATH] \ [PROJECT].Shared\App.xaml.cs 116 Active
Error CS1061 'App' does not contain a definition for
'InitializeComponent' and no accessible extension method
'InitializeComponent' accepting a first argument of type 'App' could
be found (are you missing a using directive or an assembly
reference?) [PROJECT].Droid, [PROJECT].UWP, [PROJECT].Wasm,
[PROJECT].iOS,
[PROJECT].macOS [PATH] \ [PROJECT].Shared\App.xaml.cs 116 Active
Any thoughts on how to fix this?
Downgrade your Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Logging.Filter nuget packages to version 1.1.1

C# Error CS0234 even after adding aspnetcore and extensions packages

I have a C# code that I am trying to run on VS Code. The steps I went through are as follows:
create folder (for this case we will name it "Program") for the program files and then run
dotnet new console
Replace the Program.cs file inside the "Program" folder with the Program.cs file I intend to run ( I did this with earlier C# applications and it worked)
Run the following commands to add packages:
dotnet add package aspnetcore
dotnet add package extensions
All packages above were installed successfully
I ran the command
dotnet build
but received the following errors:
error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Please tell me how I am to resolve this issue. Thank you
I implemented the solution by Jon Skeet , where I created a new folder and then used the command
dotnet new web
and managed to create a new ASP.NET Core project, complete with all the necessary libraries and links.
Thanks guys
I then transferred the files and folders I needed into this new folder and

'IServiceCollection' does not contain a definition for 'AddMvc', 'IApplicationBuilder' does not contain a definition for 'UseStaticFiles',

I have created .net core 2.0 mvc app using this command: 'dotnet new mvc' and it runs without any problems, but in vscode i have two errors:
'IServiceCollection' does not contain a definition for 'AddMvc' and no extension method 'AddMvc' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)'
'IApplicationBuilder' does not contain a definition for 'UseStaticFiles' and no extension method 'UseStaticFiles' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?) '
I'm using: Linux elementary OS 0.4.1 Loki, .net core 2.0, vscode 1.15.1.
Your Nuget Restore could have failed when loading the project. Try running dotnet restore from the command line.
Also check to make sure you have using Microsoft.Extensions.DependencyInjection at the top of the file where you use .AddMVC() and .UseStaticFiles()
i got the same problem i fixed it by adding below package in .cproj file
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.7" />
and did a dotnet restore. I am using dotnet 3.1 version.

DNX Core and DNX 4.5 always out of reference when creating a new ASP.net 5 MVC Web Application

I am trying to create some ASP.net 5 MVC Web Application using VS 2015 CE.
I am always getting error with DNX Core and DNX 4.5 as not being referenced to the project.
I tried changing the project.json file by removing entries in
"frameworks" section and keeping only one at a time from both "dnx451"
and "dnxcore50", still no luck.
I ended up with the large list of compile time error primarily because of the following error.
CS1061 'ApplicationDbContext' does not contain a definition for 'Database' and no extension method 'Database' accepting a first argument of type 'ApplicationDbContext' could be found (are you missing a using directive or an assembly reference?) DemoApp.DNX 4.5.1
and on the same lines
CS1061 'ApplicationDbContext' does not contain a definition for 'Database' and no extension method 'Database' accepting a first argument of type 'ApplicationDbContext' could be found (are you missing a using directive or an assembly reference?) DemoApp.DNX Core 5.0
Tried using 'Restore Packages' command as well but nothing happens.
I dropped the project and re-created, however same things happened again.
As far as I know it worked before and now I don't know what went wrong all of the sudden.
I resolved problem by..
Deleting the project.lock.json file (figured out this was not allowing to upgrade and resolve the References)
Running a DNVM upgrade command from command prompt.

Categories

Resources