Copy File from Assembly into a directory when using costura.fody

343 Views Asked by At

I have a spreadsheet with some information in it that I want to copy out of out my exe into a folder of the users choosing. I'm not 100% sure how to get the path to it. I'm using costura.fody which turns it into the 1 exe file

This is my latest attempt. It errors saying it can't find these files which makes sense but I'm not sure where I should be looking for them

This is where the file is (I know it says blank but I have a bad naming conventions)

enter image description here

This is the code where I'm trying to make a copy of that file to somewhere else

static void Main(string[] args)
        {

            string pathPlace = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Resources.Blank Releases sheet.xlsx");
            Console.WriteLine(pathPlace);
            File.Copy(pathPlace, @"D:\Code\Test\test.xlsx");
}

This is the output and error I get when I run it. Its found the folder where the exe is run from but thats about as good as I've gotten with it. enter image description here

0

There are 0 best solutions below