❔ ✅ 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!)
28 Replies
thats because your work directory has changed when you run your program from a different project
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
yes
Yet it doesn't work
Unfortunately
try slapping a
Path.GetFullPath(relativePath)
on it
and see what it prints out
that should tell you exactly where its lookingEDIT: 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•14mo ago
Message Not Public
Sign In & Join Server To View
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•14mo ago
Message Not Public
Sign In & Join Server To View
Core is a lie, C# never advanced further than 4.8
Sure i'll try and let you know
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
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•14mo ago
Message Not Public
Sign In & Join Server To View
Ah okey, I can try to look for errors there
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
What are you using to crop..?
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
Well I trust the wildcard/regex part of it
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
Yes wildcard
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
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
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.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?
no
Okey thank you for the first advice 🙂
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.