C
C#2y ago
exokem

Unresolved NuGet Dependency References

I have XUnit added as a dependency to my test project via NuGet. Despite this, my test project code seems to oscillate inexplicably between recognizing all of the dependency references and not. This doesn't really make any sense to me as I can successfully build and run the test project, but when I reload it all of the references become unrecognized. I have been using visual studio to set up projects/dependencies and working in VSCode, and even if I can build everything in VS just trying to scan for the test projects in VSC loses the dependency references.
20 Replies
exokem
exokem2y ago
these are all of the NuGet packages my project has installed
exokem
exokem2y ago
it's just XUnit that isn't working all the time I have other projects in the solution that do not have the same issue
sibber
sibber2y ago
you are importing the namespace right? just to make sure
exokem
exokem2y ago
it doesn't even recognize the namespace literally every other build succeeds
sibber
sibber2y ago
have you tried deleting the .vs folder and obj and whatever other stuff it generates then run dotnet restore then open vs
exokem
exokem2y ago
should I run restore on the solution directory? I have multiple csproj projects in the solution
exokem
exokem2y ago
this is the file structure with all of the csproj files
exokem
exokem2y ago
the test project only includes Xylem/test the main project (Xylem) includes Xylem/data and Xylem/src
sibber
sibber2y ago
sure
exokem
exokem2y ago
I think Xylem and Xytest are using the same obj path for building so building one clears the dependency files for the other I probably need to separate the structure
sibber
sibber2y ago
why do you even set the path
exokem
exokem2y ago
what do you mean I haven't made any manual changes to anything in any case I have rearranged the projects so no two csproj share the same folder and everything seems fine
sibber
sibber2y ago
oh they were sharing a folder
exokem
exokem2y ago
yea
sibber
sibber2y ago
yeah don't do that $structure
MODiX
MODiX2y ago
namespace Namespace;

[Attribute]
public class Class
{
public string PublicField;
private bool _privateField;
protected double protectedField;

public int PublicProperty { get; set; }

public Class() {} // Constructor

public void Method(int parameter)
{
var localVariable = parameter;
}
}
namespace Namespace;

[Attribute]
public class Class
{
public string PublicField;
private bool _privateField;
protected double protectedField;

public int PublicProperty { get; set; }

public Class() {} // Constructor

public void Method(int parameter)
{
var localVariable = parameter;
}
}
For C# versions older than 10, see $StructureOld
sibber
sibber2y ago
oops not that one anyway generally i have a src folder for the actual app and a tests folder
exokem
exokem2y ago
I had the main/test project separate so I wanted to move the tests into the main project without adding the XUnit dependency to the main project so my structure is like this now:
MainProject
src
test
TestProject.csproj
MainProject.csproj
MainProject
src
test
TestProject.csproj
MainProject.csproj
and the MainProject excludes the test directory
sibber
sibber2y ago
thats worse imo and probably most peoples opinion just have the tests directory under the root, completely seperate from source
exokem
exokem2y ago
I was thinking I needed the data directory which is at the same level as src but I don't actually so that does make sense
Want results from more Discord servers?
Add your server
More Posts
❔ UNITY Code only fully executes after running it another timeWhen running GenerateCities() it only does DestroyCities() and CreateCountryColors() before stopping✅ Recieve less than transmitting in network streamHello there, I'm trying to implement a FTP server and I got troubles with the network stream Whenevedouble.Parse(3.5).ToString() returns 35I got confused troubleshooting since web results didnt help, so i asked chatgpt and his code snippet❔ How could I make my console app not close when it's double clicked in explorer?my console app is directed towards beginners (supposed to work alongside an existing app, which is a❔ Authorization handling in asp.net coreHey, in asp.net core you can use Authorization Handlers and Type Filters to authorize a request. Th❔ Is there an equivalent feature to TypeScript's Indexed Access Types?e.g. ```ts type Example<T> = { items: T[] } type StringItems = Example<string>["items"] // stringA series of errors (Install failed & Minimal hosting scenario!) while scaffolding for a ASP.NET CoreI followed this instruction to execute the ```API Controller with views, using Entity Framework``` h❔ InputDevices.GetDevicesWithCharacteristics doesnt exist??ive never gotten this error before, i dont know if i just havent imported something that i need to? ✅ How To Run CMD C WPFHow can I run a CMD command in the event handler of a button in C# WPF?❔ TCP Connect To Public iPI Make a simple app for chat(it work in local) but dos not work for connect to public IP