How to generate OData v4 Client for Silverlight 5? - silverlight

We're trying to get set up with Web API 2.2 and OData v4 for ASP.NET + Silverlight 5.
Initiall POC had a Unit Test project connecting using Simple.OData. This worked great. But we've been unable to set up an OData Client on Silverlight 5.
Using Client Code Generator v4 and keep getting error
The type or namespace name 'Client' does not exist in the namespace
'Microsoft.OData' (are you missing an assembly
reference?) C:\Workspaces\GKS\Main\Source\Simutek.Gks\Source\Simutek.Gks.UI.SL.Common\GksODataClient.cs Simutek.Gks.UI.SL.Common
Packages:
<package id="Microsoft.OData.Client" version="6.12.0" targetFramework="sl50" />
<package id="Microsoft.OData.Core" version="6.12.0" targetFramework="sl50" />
<package id="Microsoft.OData.Edm" version="6.12.0" targetFramework="sl50" />
<package id="Microsoft.Spatial" version="6.12.0" targetFramework="sl50" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="sl50" />
References look good and we've also tried AssemblyBinding in app.config:
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.12.0.0" newVersion="6.12.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.12.0.0" newVersion="6.12.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.12.0.0" newVersion="6.12.0.0" />
</dependentAssembly>
Update: Indeed, while the Microsoft.OData.Client NuGet package installs on Silverlight it does in fact not specify SL5 in its targets.
I now see that the package only targets
portable-net45+wp8+win8+wpa
So while I can get things going in a PCL project, I can't do so in one targeting Silverlight 5.
Is there a work around, anyone who have achieved this?

You should use one of the PCLs that support Silverlight, two candidates are ODataLib (Microsoft.OData.Core) and Simple.OData.Client, the latter is built on the top of ODataLib. None of them supports class generation but it shouldn't be a big deal to roll your own.

Silverlight does not support the code generated by Microsoft's OData v4 Client Code Generator visx (OData Client T4), but no one's forcing you to use generated code.
Simply use the lib of your choice to create a connection to the OData service and reuse your own types (business objects).

Related

the element <projectreference> beneath element project is unrecognized

this is the error i am facing while adding the project reference to the .csproj file
, I am developing CRUD using ASP.net core + react js by taking help of microsoft learn here is the link:https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-asp-net-core-with-react?view=vs-2022
project reference
error i am getting
i am facing this issue can anyone help?
enter image description here
Change your .csproj file like below, the issue could be fixed.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FootBallManagement_reactjs\FootBallManagement_reactjs.esproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
</Project>

Open Profile Viewer error in Integration Services Project in Visual Studio

I'm facing an identical error to the one shown here. I have tried to add the following lines:
<dependentAssembly>
<assemblyIdentity
name="Microsoft.DataTransformationServices.ScaleHelper"
publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="15.0.0.0" newVersion="15.100.0.0"/>
</dependentAssembly>
to DataProfileViewer.exe.config as suggested. This was not successful for me. Can someone who has had the same error and successfully implemented the solution tell me where exactly in the DataProfileViewer.exe.config they placed the code shown previously? Perhaps they can add their entire file, that would be very helpful. Thank you very much.
I solved my own issue. I got the filepath wrong and was modifying a different
DataProfileViewer.exe.config to the one shown, my mistake. I modified the correct one in (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\SSIS\150\Binn) and it is now working.
Please do not make the same mistake I did.

Icon not found in WPF application

I have set Icon= "icon.ico" in MainWindow.xaml but it does not find it. I got the icon in the final build directory and in project directory. Absolut path works.
My question is: where does the Icon= "icon.ico points to from my xaml file and how to properly reference relative path?
Solved it by adding
<ItemGroup>
<None Remove="icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="icon.ico" />
</ItemGroup>
to my .csproj.

Visual Studio 2013 AngularJS intellisense support

I thought VS 2013 is supposed to have support for angularjs attribute intellisense? For some reason it's not working for me on the latest version of Microsoft Visual Studio Ultimate 2013 version 12.0.21005.1
Getting the following validation warning:
Attribute 'ng-app' is not a valid attribute of element 'html'.
Attribute 'ng-view' is not a valid attribute of element 'div'.
Am i missing an xsd reference somewhere?
I had the same problem and I did the following and it helped.
If you are using ReSharper, you can add an extension that will give you Intellisense, and won't raise a warning.
Top Menu in VS>Resharper>Extension Manager>Search AngularJS
This will add angular js intellisense.
-------EDIT-------
Using Resharper 8.2.1
I know this is old, but it was still happening for me. To fix it for VS 2013, follow these instructions:
1) Open the file C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\schemas\html\commonHTML5Types.xsd
2) Find the area in the file that starts with this line:
<xsd:attribute name="translate">. Scroll down about 7 lines to find the corresponding closing tag: </xsd:attribute>
3) Just above the </xsd:attributeGroup> closing tag, paste the following lines of code:
<xsd:attribute name="ng-app" vs:category="Angular" />
<xsd:attribute name="ng-bind-html" vs:category="Angular" />
<xsd:attribute name="ng-bind-html-unsafe" vs:category="Angular" />
<xsd:attribute name="ng-bind-template" vs:category="Angular" />
<xsd:attribute name="ng-checked" vs:category="Angular" />
<xsd:attribute name="ng-class" vs:category="Angular" />
<xsd:attribute name="ng-class-even" vs:category="Angular" />
<xsd:attribute name="ng-class-odd" vs:category="Angular" />
<xsd:attribute name="ng-click" vs:category="Angular" />
<xsd:attribute name="ng-cloak" vs:category="Angular" />
<xsd:attribute name="ng-controller" vs:category="Angular" />
<xsd:attribute name="ng-csp" vs:category="Angular" />
<xsd:attribute name="ng-dblclick" vs:category="Angular" />
<xsd:attribute name="ng-disabled" vs:category="Angular" />
<xsd:attribute name="ng-form" vs:category="Angular" />
<xsd:attribute name="ng-hide" vs:category="Angular" />
<xsd:attribute name="ng-href" vs:category="Angular" />
<xsd:attribute name="ng-include" vs:category="Angular" />
<xsd:attribute name="ng-init" vs:category="Angular" />
<xsd:attribute name="ng-list" vs:category="Angular" />
<xsd:attribute name="ng-model" vs:category="Angular" />
<xsd:attribute name="ng-mousedown" vs:category="Angular" />
<xsd:attribute name="ng-mouseenter" vs:category="Angular" />
<xsd:attribute name="ng-mouseleave" vs:category="Angular" />
<xsd:attribute name="ng-mousemove" vs:category="Angular" />
<xsd:attribute name="ng-mouseover" vs:category="Angular" />
<xsd:attribute name="ng-mouseup" vs:category="Angular" />
<xsd:attribute name="ng-multiple" vs:category="Angular" />
<xsd:attribute name="ng-non-bindable" vs:category="Angular" />
<xsd:attribute name="ng-readonly" vs:category="Angular" />
<xsd:attribute name="ng-repeat" vs:category="Angular" />
<xsd:attribute name="ng-selected" vs:category="Angular" />
<xsd:attribute name="ng-show" vs:category="Angular" />
<xsd:attribute name="ng-src" vs:category="Angular" />
<xsd:attribute name="ng-style" vs:category="Angular" />
<xsd:attribute name="ng-switch" vs:category="Angular" />
<xsd:attribute name="ng-transclude" vs:category="Angular" />
<xsd:attribute name="ng-view" vs:category="Angular" />
Save the file and reopen VS2013. This should fix the issue.
I installed http://vswebessentials.com/
created a file called
_reference.js
with content
/// <autosync enabled="true" />
/// <reference path="angular.js" />
/// <reference path="underscore.js" />
I learned about it from The Story Behind _references.js
If you are using ReSharper, try turning off ReSharper IntelliSense for HTML.
ReSharper > Options > IntelliSense > General > Limited ReSharper IntelliSense
Notes:
This does not provide AngularJS intellisense in ASP.NET files
You need to reopen HTML files in VS after the settings have been changed
Current version of ReSharper is 8.2
You could also just run this from the package manager console in VS 2013: Install-Package AngularJS.Intellisense.
Try to tick Text Editor\HTML\General\Auto list members in options.
I know this post is old and the question specifically refers to VS 2013, however if you're still running VS 2010 and want to apply puargs solution you can find the file at C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\schemas\html\html_5.xsd.
You'll want to add puargs' code within the <xsd:attributeGroup name="commonHTML5coreAttributeGroup"> section.
Mads Kristensen also discusses [applying this solution to VS 2012]1 and provides a link to an updated version of 2012's commonHTML5Types.xsd in Step 2.
Also note that both puargs and Mads listings are missing an attribute on ng-view that causes an "attribute name must be followed by an equal (=) sign" warning. The complete element is: <xsd:attribute name="ng-view" vs:category="Angular" vs:standalone="true"/>.
Visual Studio 2013 Update 4 removes the validation, however it does not include IntelliSense for AngularJS.
Support for custom elements, polymer-elements and attributes
We no longer validate unknown attributers for custom elements as there
will be many custom made tags in different frameworks. So there will
no longer be squiggles under the unknown elements.
— Announcing new Web Features in Visual Studio 2013 Update 4 RC
Download Visual Studio 2013 Update 4.
Validation is only removed in the HTML editor, not the HTML (Web Forms) editor. This means that, by default, .html files will not have custom element validation, but .aspx pages will. If, like me, you don't think this makes sense, show your support by voting for custom elements in .aspx files.
Running into the same problem. If you have ReSharper installed on VS 2013 like me, you can get the instellisense by installing the AngularJS plugin (provided by JetBrains).
Here's how to do it:
VS2013 > ReSharper > Manage Extension.
Search "AngularJS" using Nuget online, then click "Install".
The above should get you what you needed. In case you need image guide, here's the link - http://jeeshenlee.com/2014/07/12/how-to-get-angularjs-intellisense-support-on-resharper/
I have not tried with vs2013, but could work. Working with vs2012.
http://madskristensen.net/post/angularjs-intellisense-in-visual-studio-2012
I just disabled resharper intellisense for HTML pages and got angular intellisense back on VS2013
You can also get rid of warnings:
http://madskristensen.net/post/angularjs-intellisense-in-visual-studio-2012

Add scala class to DataNucleus enhancer CLASSPATH

I am writing a Google App Engine web app and wish to use Scala on the server side. I'm using Eclipse and the Google App Engine plugin. However, as soon as I add an empty Scala class source file to my project, the DataNucleus enhancer warns:
SEVERE: Class "com.my.package.UserAccount" was not found in the
CLASSPATH. Please check your specification and your CLASSPATH.
I will eventually get round to making the class persistent but I want to get rid of this error first.
So far I've added the Scala Nature, and have tried cleaning the project and also restarting Eclipse but I always get the same warning issued from the enhancer.
Any ideas on what I can do to get the enhancer to run successfully?
I've struggled away with this for the last few days. Class not found errors thrown by the datanucleus enhancer on Scala classes occur because the scala-library.jar file isn't in the classpath when the enhancer runs. I've found two solutions:
Simple but cludgy: Copy scala-library.jar to the folder in eclipse/plugins which contains the enhancer. For me this is currently: /opt/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.5.5.r36v201110112027/appengine-java-sdk-1.5.5/lib/tools/orm
Switch off the enhancer builder in your project properties and create an ant file to run it manually. You can then properly control the classpath. I really struggled to get the scala-library into the classpath so gave up and copied it into the same folder as my datanucleus jars. My ant file if anyone's interested is:
<project name="DataNucleusEnhancer" default="enhance" basedir=".">
<property name="base.dir" location="/home/steve/Projects/DNProject"/>
<property name="datanucleus.libs" location="/home/steve/Projects/Jar Libraries/datanucleusjars"/>
<property name="sdk.dir" location="/opt/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.5.5.r36v201110112027/appengine-java-sdk-1.5.5"/>
<property name="classes.dir" location="${base.dir}/war/WEB-INF/classes/"/>
<property name="entities.dir" location="${base.dir}/war/WEB-INF/classes/packagenamehere/entities"/>
<path id="enhancer.classpath">
<fileset dir="${datanucleus.libs}" includes="*.jar" excludes="" />
<fileset dir="${sdk.dir}/lib/user" includes="*.jar" />
</path>
<target name="enhance" description="DataNucleus enhancement">
<taskdef name="datanucleusenhancer" classpathref="enhancer.classpath" classname="org.datanucleus.enhancer.tools.EnhancerTask" />
<datanucleusenhancer dir="${classes.dir}" failonerror="true" verbose="true">
<fileset dir="${entities.dir}" includes="**/*.class" />
<classpath>
<path location="${base.dir}/war/WEB-INF/classes/"/>
<path refid="enhancer.classpath"/>
</classpath>
</datanucleusenhancer>
</target>
</project>
In testing I also found the enhancer unwilling to enhance classes if I had no namespaces. I'm also concerned that I now need to manage the copy of scala-library.jar to make sure it's the same as in the scala eclipse plugin. It'd be much better if the gae plugin worked properly!
I tried the option 1 of steve's answer dropping the scala-library.jar in the eclipse plugin folder. It is still not solving yet. I then drop scala-library.jar in PROJECT/war/WEB-INF/lib/ and add it to Build Path. It works! So I undo option 1 of steve's answer by removing the scala-library.jar from the eclipse plugin folder and restart the eclipse. I try again and it still works! I am using eclipse 2.7.1, scala 2.9.1 and scala-ide 2.0.0

Resources