Share WPF Resources between 2 Non-Referenced WPF Projects - c#

I have 2 Class Libraries that contain WPF Controls and resources in a Solution. I want to be able to share resources between them at Design-Time so I can actually see what I'm designing. At run-time everything is ok, as I am loading the dlls dynamically.
If I reference each project to each other I get a circular dependency issue
I am using blend & if I add a reference to the DesignTimeResources.xaml, a project reference is added which I don't want.
Any help appreciated.

Create a common project, and have both projects reference it. Then you will not have a circular reference.
If you make the class static, then it is even easier to share data.

The below link demonstrates step by step process to achieve your requirement. I hope this will help you.
Set up the project for design-time debugging

Related

Can't see items from one project in another C#

I have all of my references set up, and the classes are public, but I still cannot see the classes and project in the project I'm working in. Does anyone have any other ideas to try? Thanks!
There can be number of reasons for this.
Please Check If added the Reference Correctly to your project
Then Check your accessor methods in the referring project.make sure you use the public keyword for classes and methods you want to reference.
Bothe projects should be in same .NET version or Reference project should be less than the refereeing project
if you can show the specific code both projects it's easier to determine

Two projects with same dll, Cast issue

Hi fellow programmers,
I'm creating a ControlLibrary for future project's that uses the amazing MaterialDesignXaml library. In this ControlLib I use the MaterialDesignThemes.dll that contains several styled controls, resources and classes.
Now my problem is that I need to use the same dll's in the real application (sae sollution for now). If I want to use the mentioned control library in this project (as project reference) I always get this error:
Dll Error in Application Project
.
I understand the problem the compiler has with this, since It cannot check if two refrences (from seperate projects in the sollution) are the same dll. But how can I fix this?
The strange thing is that the designer complains like in the screenshot, but the application runs just fine...
I'm using TortoiseSVN for Version Management, maybe this has to do something with it?
Any idea's?

Unity not finding dll references

We are doing a project that uses interfaces and Unity to resolve concrete implementations of classes.
My questions is the following: I need to get my dll's all into the same folder otherwise unity will not be able to resolve the interface etc. So according to me I have a couple of options:
1. Add the projects with the implementations as references and let VS copy the files to the output folder (for some reason this just feels like a hack)
2. Change the build location of all my projects to build to the same folder
3. Create a post build event to copy all the files needed to whereever they need to go
I have implemented to second option but this could lead to files in your build folder that should not be there. I am not a big fan of post build events, so I would like to ask from other people using Unity what they found to be the best solution for them.
Thanks in advance
The first approach sounds like the right one to me. Your project does depend on the implementation libraries; it doesn't express that dependency directly in code, but it requires them, so it seems reasonable to add a reference to them.
This is basically the same situation as where you've got three projects, where project A depends on project B, which depends on project C - you need to explicitly add project C as a reference within project A. Visual Studio doesn't work out transitive dependencies for you (at least it didn't the last time I checked).

Adding this project as a reference would cause a circular dependecy

I'm working on an MVC 3 project. I was told to get all the models and viewmodels out of the projects and put them in a class library so that they can be referenced from different types of projects. However, now that I've transferred all the viewmodels and models from the web project to a class library, and removed all the references to the web project, I cannot set reference to the class library from my web project with the reason stated in the question title. WHy is this happening? In my class library I'm not referencing the main project anywhere!!! Any suggestions? Thanks a lot!!
Experienced this earlier. Check the project that you are going to add if it has the reference to the project you are adding in it.
Example: Project A with reference to Project B. Then in Project B, you're adding Project A as reference.
well this usually happens for a reason, and this is that there is a cirrular reference,maybe not a direct one but an indirect one (through third project, how many projects do you have in your solution?).
In your library project remove all other projects references from solution, and try it again.
good luck
almir

compact framework design time support from external dll

I know this has been asked before, and also there are answers which solves the problem partially. I've some user controls which we use in our warehouse mobile application framework, and to get design-time support I use DesktopCompatible custom arrtibute in DesignTimeAttibutes.xmta file.
This solves the problem if both the library and the UI project is in the same solution. For example I have this solution layout :
Company.Mobile (Solution)
Company.Mobile.Library (Project) this has DesignTimeAttributes.xmta
Company.Mobile.Project1 (Project)
Company.Mobile.Project2 (Solution)
Company.Mobile.Project2 (Project)
So when I reference Company.Mobile.Library from Company.Mobile.Project1 I have design-time support for the controls, but not from Company.Mobile.Project2. I also tried to copy xmta file to Project2 but still doesn't work.
Any ideas?
Thanks.
Besides having your library dll, you should also have an extra dll called yourlibrarydll.asmmeta.dll. Try coping this dll into the output folder of your Project2.

Categories

Resources