C
C#14mo ago
OkOk

❔ ✅ C# program can't find folder in the very same directory

My program works fine but when I instead run the main program's functionality from a test-project then it can't find the folder named "python_scripts" I even put a duplicate folder without links in both project, original files with no links Project 1 works fine called "PredictionService" Project 2 doesn't work called "ComputationServiceTests" (even though it should be a copy of the essentials!)
No description
No description
28 Replies
Pobiega
Pobiega14mo ago
thats because your work directory has changed when you run your program from a different project
OkOk
OkOkOP14mo ago
That's why I made a copy of the folder and contents in the new project for testing, is looking for a relative path in the same directory
Pobiega
Pobiega14mo ago
yes
OkOk
OkOkOP14mo ago
Yet it doesn't work Unfortunately
Pobiega
Pobiega14mo ago
try slapping a Path.GetFullPath(relativePath) on it and see what it prints out that should tell you exactly where its looking
OkOk
OkOkOP14mo ago
EDIT: I was not able to solve it from there You sir are a genius and a scholar, I think that I can solve it from there I tried to slap that on and saw that the program was looking for the path "PredictionServiceTests\bin\Debug\python_scripts" Which I thought was a good start since I first assumed it would look in "PredictionServiceTests\python_scripts" It turns out there also was a generated "python_scripts" already in the bin\Debug which the program couldn't find either, so I'm back at square one
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
I haven't studies msbuild or know why it copies files into the bin\debug but I'll assume it's for good reason I'll try that
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
Core is a lie, C# never advanced further than 4.8 Sure i'll try and let you know
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
I tried to remake this existing line: <None Update="python_scripts*"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> so it looked like yours: <None Include="python_scripts*"> <CopyToOutputDirectory>PreserveNewsest</CopyToOutputDirectory> </None> But it didn't work to change or keep both
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
Ah okey, I can try to look for errors there
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
What are you using to crop..?
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
Well I trust the wildcard/regex part of it
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
Yes wildcard
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
OkOk
OkOkOP14mo ago
I'm way out in deep water on what the CopyToOutputDirectory is supposed to do, I'm reading examples on google but without some reading on msbuild I think this will be hard I tried Content as well but it's the same error
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
OkOk
OkOkOP14mo ago
Hey I read up and to me it seems like it shouldn't matter if it's "None" or "Content" Neither should it matter to the error if it's the current setting of "Always" or your suggestion "PreserveNewest" Is there something else you might recommend me reading up on to fix this? Can I bother you for a suggestion of something to look into?
Pobiega
Pobiega14mo ago
no
OkOk
OkOkOP14mo ago
Okey thank you for the first advice 🙂
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server