I'm working on a windows application (C#
) that was created in VS 2012 (Framework 4.5
) windows forms. The requirements requires it to be used for older versions of windows so I'm setting the target framework to .NET Framework 4
and Platform target to x86
. Once its done and I try to compile I get the following error:
Custom tool error: Failed to generate file: The service reference is not valid for the current .NET Framework version or project type. You can change the service reference configuration in the .svcmap
I tried unchecking the box "Reuse types in referenced assemblies
" in the Service References before flipping to framework 4 but no luck.
Instead of re-adding the reference you can also remove the code which is not understood by .NET 4.0 from the Service References\<reference name>\Reference.svcmap
file. Note that you will need to navigate to this file via explorer, it does not show up in Visual Studio. For my references, I simply removed this line
<GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod>
Then right-click the service reference in VS2013 and hit "Update Service reference". It will rescan the service and generate the Reference.cs file so that it is compatible with .NET 4.0.
Apparently, sometimes this error can be avoided by simply re-adding the reference. Have you tried that?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With