Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi cracks,

i wrote a WPF custom control libary. So when using them in a test application everything is fine.

Im developing an addin for a Win32 application. When using my custom controls in an WPF element host. The WPF UserControl throws an XAML.Parse Exception "FileNotFound".

So my buddy told me to create a custom control in code in the codebehind file of the UC.
Now everything is fine and works.

Other solution was to copy the custom control libary to my application folder of the Win32 App.

Can anybody explain me what is happening or how can I avoid those problems.
So that I don't need to create a custom control in codebehind or that i need to copy my custom control libary to the Win32 application folder.

Your help would be very much appreciated

Greets Max

What I have tried:

Copy custom control libary to Win32 application folder
Create custom control in codebehind
Posted
Updated 4-Oct-16 20:55pm
Comments
[no name] 27-Sep-16 8:22am    
This was most likely happening because that's how computers work. Programs have to be able to actually find the files they need so it's up to you to learn how computers work so you can enable your programs to have access to the necessary files.
Sinisa Hajnal 27-Sep-16 9:26am    
Check any application you use regularly. You'll see an exe file and bunch of various other files. Those are your "code behind" and control library files. You have to compile them and distribute them along with your application.

Better practice is to have it in separate library and not within application code so you could deploy new version of the control without affecting main app.

1 solution

some time since you asked this question... - what about your deployment now? Did you get it right?

Your question is a little confusing because you talk about a CustomControl - this is a special type in WPF: you derive controls with your own ControlTemplate (theme) from it - opposed to a UserControl where you compose existing controls together - far more likely in WPF). So I don't understand what you mean with "in code behind"...
Anyway, if your control worked on your developer pc(where all dependencies existed) it should be logical that the code doesn't need any change. You just didn't setup your runtime environment correctly.

In general: If you have a library with controls/functions your application needs, you have to deploy it to the target computer. Best way is to do this in an automated, repeatable, and controlled process - with a SETUP ;)

But before you can create a setup you have to understand how references and dependencies work on your target systems and for your programming platform and language/framework. It seems it could not do any harm if you spend some minutes reading MSDN on this topic? e.g. here Managing Dependencies[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900