I want add file reference in assembly in Visual Studio to some file on the hard disk. And also i want place the file in the resources of the project. But after i added file into resources, Visual Studio replace my own file reference to resources directory. E.g. i added reference C:/Dir/myfile.dll, Visual Studio replace it with MyProject/Resources/myfile.dll. I need my assembly looking for file at C:/Dir/ location. Obviously, assembly search the file in startup directory first, and crashing if can not find it. Can I forced set my assembly searching order of referenced files?
Asked
Active
Viewed 53 times
0
-
Maybe you can try to rename the resource dll as a workaround :) – Ilya Chernomordik Oct 28 '16 at 17:04
-
@IlyaChernomordik What the nice and simple solution) i'll check it. Thanks. – Aave Oct 28 '16 at 17:06
-
If that helps I can create an answer that you can accept :) – Ilya Chernomordik Oct 28 '16 at 17:07
-
@IlyaChernomordik Visual Studio can find side-part assembly in that way, and not change reference added by me. But it copy this assembly in startup folder now) It wasn't exactly what i need, and maybe my question was not correct. I need use absolute path in XAML xmlns definitions. Not shure it is possible... But your answer helped me. Thanks. – Aave Oct 28 '16 at 22:10
-
What is the reason you need the dll in resources in the first place? Maybe there is a better solution? – Ilya Chernomordik Oct 29 '16 at 10:06
-
@IlyaChernomordik i need check if dll is presented on local machine, and if not, copy the dll from resources to hdd. And then use it in my app. – Aave Oct 29 '16 at 10:29
-
And i want place dll in certain location, not into app startup directory. – Aave Oct 29 '16 at 12:27
-
And why does app startup does not work? – Ilya Chernomordik Oct 29 '16 at 14:04
-
@IlyaChernomordik It's works, but i need use exact file location on the harddisk. – Aave Oct 30 '16 at 11:19
-
I understood that, I mean why is that you need to use exact file location? If you can just use it ordinary way then it'll always be in your bin folder. What is the reason for doing exact location? (I am asking since there can be a better solution perhaps to the original problem you are trying to solve. – Ilya Chernomordik Oct 30 '16 at 11:22
-
@IlyaChernomordik users run portable application from desktop often. I just not like when some app creates different files on desktop. It's more nice when app creates additional files in the some hidden location, e.g. in temp directory. Imho) Do you know more acceptable solution? – Aave Oct 30 '16 at 12:43
-
Sorry, not an expert on portable applications :) I suppose just a shortcut won't cut it. But I suppose the bin folder should be somewhere not on desktop. Anyway I guess I cannot help you more, sorry :) – Ilya Chernomordik Oct 30 '16 at 12:45
-
I know that my app will run from user desktop. – Aave Oct 30 '16 at 12:45
-
@IlyaChernomordik Thank you! Your advice will the part of my final solution) – Aave Oct 30 '16 at 12:47
-
Then I'll add it as an answer and you can upvote it and accept if you don't get a better answer :) – Ilya Chernomordik Oct 30 '16 at 12:49
-
@IlyaChernomordik Ok. I'm new at this site. How can i do this? I'm using mobile app. – Aave Oct 30 '16 at 12:50
-
Added an answer. If you accept it and upvote then both me and you will get some score :) – Ilya Chernomordik Oct 30 '16 at 12:51
-
@IlyaChernomordik I accepted, but can't vote. My rating is too low. – Aave Oct 30 '16 at 12:52
-
np :) glad I could help, just not too much – Ilya Chernomordik Oct 30 '16 at 12:53
1 Answers
0
I can suggest you as a workaround to rename the file that you put in the resource, that should at least stop overriding your library.

Ilya Chernomordik
- 27,817
- 27
- 121
- 207