user3678158
user3678158

Reputation: 25

In C# solution, created referenced dll in debug folder, odd situation

I experienced some odd situation in build solution of c#.

All 5 projects in a solution.

A.exe B.dll b.dll C.dll c.dll (B, b, C, c are all usercontrol project).

A.exe referenced B.dll and C.dll.

B.dll referenced b.dll.

C.dll referenced c.dll.

All referenced option is "Copy Local" : true.

When A.exe project is builded, In Debug folder, A.exe and B.dll and b.dll and C.dll are created. (not c.dll).

At last I have known that the reason of difference.

b.dll usercontrol is used in B.dll xaml having b's element name.

but c.dll usercontrol is used with no name.

The difference of B with C is just whether the used control's name is used or not in xaml.

Any one can explain, why this difference is result in the dll copy or not in exe project debug folder?

Upvotes: 0

Views: 355

Answers (1)

Yuval Itzchakov
Yuval Itzchakov

Reputation: 149538

When you give a control a x:Name, it causes it to create an instance for it in the generated code behind (partial) class. This is enough for the reference following system to detect the reference, and copy in the dependency dll.

That's why you're seeing the difference in behaviors.

Upvotes: 0

Related Questions