I am new to both WPF and WCF, and have a WPF app that has a service reference to a WCF one. I have all sorts of files created under Service References/MyService. I am not so sure which need to go into source control and which don't.
I have a .disco, a .datasource, a .wsdl, 3 .xsds, 2 configuration.svcinfos, a Reference.cs,
and a Reference.svcmap.
I assume most are generated, yet I don't know which belong to source control and which do not.
Put all of them under source control, why not?
It's part of your code and it's needed to compile the project. If you use an automated build system, then you don't want that script to generate this code again, right?
As a bonus you'll get a history of changes to your service interface, could be useful too.
All of those files are source files, so they all belong under source control.
How about adding all of them to the source control in the first instance and then remove those that never change later?
Related
Let's say that I have a simple WPF or Winforms solution. To that solution I add a new project (based on a class library template , which I then reference in the main project) which is intended to be a data layer containing an entity framework data model. When I create the data model in the new project the connection string that it uses gets added to the app.config file of the main project in the solution.
Now let us say that I want to add two more projects to the solution (both of which will again be based on class libraries) to contain details of WCF services that I wish to use. In each case I add the WCF service by using the ADD Service Reference option from the right click context menu of the projects.
Unlike the data model project though the bindings for the service model get added to the local projects app.config file ass opposed to the app.config file of the main start-up project.
Should I simply copy those bindings to the start-up project's app.config file, or should I copy and then delete, or in fact should I be doing something completely different. Thus far trying combination of the first two suggestions I get error messages connected with endpoint configuration, however my knowledge of WCF is not really sufficiently good to fully understand the MSDN articles that the error list points me to.
Note that if the service references are added to the main project I get no errors whatsoever, so I figure this must be a configuration problem of some description.
Would anyone be able to provide the correct procedure for adding projects that essentially contain no more than a WCF service reference to an existing visual studio solution.
Edit
The screenshot below shows my main app.cofig file after having copied over the bindings configurations from the two service contracts. I'm not sure whether I should have commented out the bit that I did or not, I had thought that by doing so I might get rid of the blue squiggly underlines telling me the following (which I must admit to not understanding):
Warning The 'contract' attribute is invalid - The value 'ErsLiveService.IERSAPIService' is invalid according to its datatype 'clientContractType' - The Enumeration constraint failed.
You're likely getting the blue squigglies because the namespace ErsTestService is defined within the project in which you created the service reference. If the root namespace of that project is MyServiceReferenceProject then try changing the namespace to MyServiceReferenceProject.ErsTestService.IERSAPIService.
I am using VS2008 to publish my application files using ClickOnce. I read somewhere that ClickOnce intelligently does only partial updates; meaning it only downloads files from the network share if the file has changed in subsequent updates. However, this wasn't working for me. So I did some research and stumbled upon this MSDN article - http://msdn.microsoft.com/en-us/library/ms404267.aspx. It says that if we build using VS, it doesn't perform the partial updates. Can anyone tell me why this is the case? If so, is there a way to atleast let the referenced dlls to be downloaded only for the first time. I am using Microsoft Practices Enterprise Library and some 3rd party controls (with huge Theme files).
Thanks,
Uniball
Partial updates work fine in ClickOnce even when building in VS. However, if you have a solution made up of a few projects (eg a couple of class library projects and an executable) then any time you rebuild all the projects the timestamp on the assembly files will change, even if the code hasn't. Since ClickOnce really only looks at the timestamps to decide whether a file needs updating, it'll pull down the (unchanged) assemblies as new files when the user updates.
The workaround is to pull any dependent projects out of your executable's solution file and build them separately. That means that any assemblies whose code doesn't change very often will only get pulled down to the client once. If you need to change the assembly, you simply open its solution and make the change, then reopen your executable's solution and rebuild that. The next ClickOnce update will pull down both the exe and the changed assembly.
Hope that's clear enough!
I have a Silverlight solution that has multiple silverlight projects (Views) that all compile to their own .Xap file.
There is one "master" project that handles the dynamic downloading of the Xap files, which works pretty well.
But now I need to make sure that all the references are set to CopyLocal=false in all the View Projects. Only the "master" project can have CopyLocal=true.
This means that the Xap files generated by the Views stay rather small.
What I would like to do is check post or during the build process to see if any of the View projects have a reference with CopyLocal=true.
What would be a smart way of doing this? Using an external tool in the Post Build event? Or perhaps an addin for Visual Studio ? Or creating a macro in Visual Studio for this?
I have looked at using .extmap with assembly caching, but since you have to specify the assemblies in that, this does not solve my problem. I just need to know if there is a reference with the wrong setting and report that. Fixing it is not the question, that will still be done manually. It's just the notification I need.
Solution has 35 projects now, so dont want to check them all by hand every time.
I found a question similar to this one, but it lists msbuild as a possible solution. I would like to know if there is a way to do this using "code" (be it prebuilt in a tool/addin or otherwise)
I have chosen to go the Addin path. I created an addin that listens to : BuildEvents.OnBuildBegin
Whenever that event fires I create a list of all projects in the current solution. Doing a bit of recursive searching since there are also Solution folders that make life in DTE world a bit harder.
Then I loop through all the projects and cast them to a VSProject so I can loop through all the references.
Anytime I come accross a reference that is wrong, I create an ErrorTask where I set the Document property to the full solution path of the reference. To do this I Build the path for the project this reference is in, all the way up to the root of the solution.
The ErrorTask is then sent to an ErrorListHelper class I created, that handles the ErrorTasks and also performs navigation.
If I'm done with all the projects and I found any errors, I cancel the current build and show the Error List window, where my ErrorListHelper holds all the Reference Errors I created.
Whenever I want to navigate to the Reference in question, I activate the Solution Explorer window and get the root of it using an UIHierarchy.
Then I walk the path from the root on down, step by step, using the UIHierarchy to get to the UIHierarchyItems and expand them. Until I get to the deepest level (the reference) and I Select that.
Since I only need it for a certain solution and within that solution for certain projects (.Views.* and .ViewModels.*) I also have some checking for those in place during buildup of the Error List.
It works like a charm, already found 12 "wrong" References in 35 projects where I tought all were well.
I am using a different path now to do this. I have a base class that I can use to write unit tests that have access to the DTE2 object. This way I dont need an addin. This also works for Silverlight projects since the test class does not actually need access to the Silverlight projects, just being in the solution is enough to be able to iterate through the projects and check the references.
I'm putting together a simple help system for my WPF app using XAML FlowDcouments (just .xaml files, no code-behind). I've simply added them to my project with Build Action = Resource, and I can load and display them as required.
Now, I'm trying to make it a bit more flexible, in that after the installation of the app, I want the user to be able to download additional (or newer versions of the existing) FlowDocument XAML help files. Given this, I'm now wondering where the best place to store these files is. A few questions/ideas:
Can I leave them as resource files, and overwrite or add new files as required? I can't find a example of how to add/edit resources at runtime on SO/Google. Is it even possible?
If not, is there a recommended location to store these files? They should be available to all users, so they can't go into the User's directory - they would have to go in the program directory. Does the program directory have write-access (I remember having issues with that before)?
Any other ideas?
Thanks.
The resource files are embedded into the executable and therefore you cannot change them.
As for a common place to put your downloaded help files, you cannot store them in "Program Files" since you would need admin privileges to write there.
I suggest you put them into SpecialFolder.CommonApplicationData (see http://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.80).aspx), which is defined as "The directory that serves as a common repository for application-specific data that is used by all users."
We have an automated test suite, using Borland Silk Test 2008 R2 to carry out regression tests of a new in-house product.
The test script consistently refers to controls by their index:
Form.Control3 ...
We've made a "minor" change to the main form of the application, and now the control that used to have index 3 has index 4.
The easy, but tedious, fix is to edit the scripts to reference Control4 instead of Control3, but this remains pretty brittle.
How do we instead identify the controls by name - so instead of referencing Control3 we specify "the control named ribbon".
(We believe that referencing things by name will be significantly less brittle.)
We've tried the obvious:
Form.ribbon
which doesn't execute at all.
The primitive intellisense in the editor doesn't show much of use - no Controls property, no GetXX or FindXX methods.
Our application is written using C# on .NET 3.5, and does make use of third party controls.
SilkTest usually stores the information to locate the controls in you application in an .inc file. The part
Form.Control3 ...
you mentioned is a reference to the structure in that .inc file. When you application changes, you should be able to adapt your test scripts by simply updating the entry in the .inc file.