I have to reference FolderX in my application after publish/deploy in Azure... The folder FolderX is in my publish Folder, but everytime I try access get me a error: "Directory not found: \n/home/site/FolderX !"
I have the following code in my csproj:
<ItemGroup>
<Content Include="FolderX\**" CopyToPublishDirectory="PreserveNewest"/>
</ItemGroup>
Now, I have to reference FolderX in my application after publish/deploy in Azure... The folder FolderX is in my publish Folder, but everytime I try access get me a error: "Directory not found: \n/home/site/FolderX !"
Since in my publish Folder, "FolderX" is in the same level of wwwrot, I try reference FolderX in this way:
string filePath = Assembly.GetExecutingAssembly().Location + @"\"; //pick a path "wwwrot" and return 1 folder
string filePath2 = Path.GetDirectoryName(filePath);
string DiretorioSchemas = Path.GetDirectoryName(filePath2) + "/FolderX";
But It's continues give me a error: "FolderX not found!". Where am i going wrong?
EDIT: Thanks @rahularyansharma
Resolve: Get XML comments output file location for ASP Core
Note: dotnet 6.0 removed this lib, so for this implementation a nugget must be downloaded.
string basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath;
string folderPath = Path.Combine(basePath, "FolderX");