Recently I was working on a client and needed to use the Remoting service. I thought it was quite simple. I was delayed for a long time due to a small problem yesterday, but it was okay to solve it, I still don't know why ~ Hi, I look forward to answers from the experts ~
There are two projects in the Project, corresponding to ViewModel (Class Library Project) and View (WPF Application Project) respectively ).
Add a RemoteObject reference to ViewModel and use the object in the reference. During compilation, the ViewModel project was successfully compiled, but the View compilation failed.
At first, I thought it was a RemoteObject reference problem. I also added the RemoteObject reference application to the View. The re-compilation is still the same. However, I noted out the sentence used in the ViewModel TO THE RemoteObject object, and the compilation was successful again. Compared with the existing references in the two projects, they are similar. Then try to use the RemoteObject object in the View.
Test.RemoteObject.Data.Station sta;
The "namespace" Test "does not contain a type or namespace name" RemoteObject "(is the Assembly reference missing ?)"
In my personal knowledge, I really don't know what the problem is. The reference has been added, and the above definition can be prompted automatically when the code is manually written, how can we compile it !?
I have searched the internet for a long time and cannot find a solution.
Try to use the Demo to verify what the problem is. Is there a problem with the project type, or is there a lack of other references !?
Add the RemoteObject reference in the Test1 (WPF Application Project) Project of the Test Project that was previously used, and use the object to compile it.
However, when I add a new (WPF Application Project) Test2 Project under the same Project again, the result of doing the same thing is -- Compilation failed. I deleted all the extra content and applications in Test1 to eliminate the impact, but the rest of the two projects was almost the same, or Test1 can pass Test2.
In the face of two almost identical projects, I finally reported a little hope and changed the property settings of the project. then I suddenly realized that the original problem was here.
WPF Application Project. The default value is
That is, Test2 started with this setting and changed it
Compile again -- OK! Actually, it passed ~ Let's look at Test1 again, because the settings required during previous use have been changed to ". net framework 4.
Back to the previous project, the project can be compiled by law. It's a good solution, or it's a waste of time ~ Currently, it can only be understood that the framework Assembly has an impact on the use of the Remoting object. As for what the impact is, I really don't know it. It is to be further understood ~