OData / odata.net

ODataLib: Open Data Protocol - .NET Libraries and Frameworks
https://docs.microsoft.com/odata
Other
687 stars 349 forks source link

Support Visual Studio Update 2 #527

Closed philip-reed closed 8 years ago

philip-reed commented 8 years ago

Short summary (3-5 sentences) describing the issue.
Client Code Generator doesn't appear to support Visual Studio Update 2.

Assemblies affected

??

Reproduce steps

The simplest set of steps to reproduce the issue. If possible, reference a commit that demonstrates the issue.
Using Visual Studio Update 2 with the OData Client Code Generator Extension installed. Configure MetadataDocumentUri to target a valid odata URL Right click the ODataClient.tt -> Run Custom Tool : Does not generate code.

Expected result

ODataClient.cs is generated with code that builds.

Actual result

ErrorGeneratingOutput is placed in ODataClient.cs

Additional details

Error list mentions missing references to mscorlib, system.xml. Recent update to T4 Templates to support C#6 perhaps?

rsmaloney commented 8 years ago

tried doing a repair on VS Enterprise 2015 and still doesn't work for me.

here is the common error stack between different apps using different client code instances :

Severity Code Description Project File Line Suppression State Error Compiling transformation: The type 'Func<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

Error Compiling transformation: The type 'XmlReader' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

Error Compiling transformation: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

Error Compiling transformation: Operator '!=' cannot be applied to operands of type 'method group' and ''

Error Compiling transformation: foreach statement cannot operate on variables of type 'System.Collections.Generic.IEnumerable' because 'System.Collections.Generic.IEnumerable' does not contain a public definition for 'GetEnumerator'

Error Compiling transformation: The type 'IEnumerable<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

Error Compiling transformation: foreach statement cannot operate on variables of type 'System.Collections.Generic.IEnumerable' because 'System.Collections.Generic.IEnumerable' does not contain a public definition for 'GetEnumerator'

Error Compiling transformation: foreach statement cannot operate on variables of type 'System.Collections.Generic.IEnumerable' because 'System.Collections.Generic.IEnumerable' does not contain a public definition for 'GetEnumerator'

Error Compiling transformation: foreach statement cannot operate on variables of type 'System.Collections.Generic.IEnumerable' because 'System.Collections.Generic.IEnumerable' does not contain a public definition for 'GetEnumerator'

Error Compiling transformation: Operator '==' cannot be applied to operands of type 'method group' and 'string'

Error Compiling transformation: foreach statement cannot operate on variables of type '?' because '?' does not contain a public definition for 'GetEnumerator'

Error Compiling transformation: The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

DickvdBrink commented 8 years ago

Same issue here - also on update 2

dtotzke commented 8 years ago

Same issue here on update 2. I receive the same errors as listed by rsmaloney. Probably related to this: https://connect.microsoft.com/VisualStudio/feedback/details/2540224

komby commented 8 years ago

We are also having this issue after running update 2.

markdstafford commented 8 years ago

Thanks for the +1s, it's good to know that this isn't just a single corrupted-state issue. We'll find some time to investigate in the next week.

LaylaLiu commented 8 years ago

We are still investigating this issue.

One workaround is to use another extension tool OData Connected Service to generate the client code.

Please do not check the "Whether to include the T4 files into this project".

blairmcg commented 8 years ago

Is it built as a .net portable lib? If so, it should be retargeted to the full .net framework that VS itself runs on, which should fix this issue.

KeffiH commented 8 years ago

Perhaps not relevant but although my project is targeted at the full framework I am using Microsoft CommonServiceLocator with MVVMLight, which I notice has a portable library. Have the same T4 issues.

blairmcg commented 8 years ago

Hmmm, @KeffiH, I think that probably is relevant. If you have a dependency on something built against the PCL, then you have the same T4 issue. This makes the limitation rather more important, as although there is no particularly good reason to build something that depends on EnvDTE as portable (since VS itself is hardly portable), there may be a need to ref a portable lib that has to be portable.

lisamariet commented 8 years ago

Just discovered same issue in our code. Also saw this bug registered.

Also getting the same mscorelib 2.0.5.0 error as mention above.

philip-reed commented 8 years ago

Is anyone able to give an update on this issue please?

lisamariet commented 8 years ago

I used the workaround mentioned above. OData Connected Service. That works! :-)

KeffiH commented 8 years ago

Same here.

philip-reed commented 8 years ago

@lisamariet @KeffiH I cant see anything in the docs that show how this work around generates the client side proxy classes. Am I missing something? With the OData Client Code Generator, I right click on the .tt file in my client app and choose 'Run Custom Tool'. What is the equivalent process for the work around?

*Edit: I was looking at the docs for the wrong extension, "OData v4 Web API Scaffolding" and not "OData Connected Service". Can't find any usage instructions for the "OData Connected Service" Extension.

lisamariet commented 8 years ago

http://odata.github.io/odata.net/#OData-Client-Code-Generation-Tool

I followed this tutorial.

jimnoble commented 8 years ago

+1, just tried to crack the cover on odata client in this tutorial:

https://blogs.msdn.microsoft.com/odatateam/2014/03/11/tutorial-sample-how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class/

and this issue is a breaking roadblock :(

This occurs with a vanilla console app, targeting full framework 4.5.2 with no extra dependencies.

mattjvan commented 8 years ago

+1

rahul7720 commented 8 years ago

I'm also having same issue after updating Visual Studio 2015 - Update 2. I'm using OData Connected Service Extension. Getting 'ErrorGeneratingOutput' on generated file.

markdstafford commented 8 years ago

We are following up with the VS team. At this point we believe this to be a VS change that caused the break. We've heard of some other T4 templates that are broken as well. We will keep you posted.

dtotzke commented 8 years ago

Active connect report here: https://connect.microsoft.com/VisualStudio/feedback/details/2540224

blairmcg commented 8 years ago

Given the blocking nature of this issue we have created a hot-fix for it that will be published as part of the next regular update to VS2015 Update 2. That should happen within the next week, and I'll be sure to post here when it does, however you can also keep an eye on this page: https://msdn.microsoft.com/en-us/library/mt695655.aspx Once this update has been published it can be applied to an existing Update 2 installation by just installing the separate KB download, and it will be automatically included in any new Update 2 install after that point.

hawk4031 commented 8 years ago

For everyone subscribed, the patch for this was uploaded yesterday (5/4).

komby commented 8 years ago

Anyone else having an issue with this patch just spinning and spinning at waiting for updates?
image

hawk4031 commented 8 years ago

The installer took a couple of minutes for me. No issues.

markdstafford commented 8 years ago

Thanks @hawk4031. Did it fix the original issue? Other folks, is it working for you?

hawk4031 commented 8 years ago

@markdstafford Yes I tested it out with the T4 template we are using and it worked immediately. Thanks for looking into this and getting a fix out quickly!

markdstafford commented 8 years ago

Great, glad to hear it! (Although we actually didn't do anything... the VS team fixed the core problem.) At any rate, thanks to everyone who reported this issue. If anyone has continued problems here, please let us know and we'll reopen this issue.