I need to generate a class from an xsd in net core.
In dotnet standard I used commandline xsd filename.xsd /c.
But how to I create this class in net core.
Anyone knows how to do this?
When I add a class generated with xsd.exe I get several errors.
Example
Error CS0234 The type or namespace name 'SerializableAttributeAttribute' does not exist in the namespace 'System' (are you missing an assembly reference?)
Error CS0234 The type or namespace name 'DesignerCategoryAttribute' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?)
Error CS0234 The type or namespace name 'XmlTypeAttributeAttribute' does not exist in the namespace 'System.Xml.Serialization' (are you missing an assembly reference?)
Error CS0246 The type or namespace name 'AnonymousType' could not be found (are you missing a using directive or an assembly reference?)
Attributes from a class in autogen file
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
I have now solved this issue with adding nugets to my project.
System.Xml.XmlSerializer
Solution: Removes the serializations attribute issues except the DesignerCategoryAttribute
Newtonsoft.json
Solution: Removes the DesignerCategoryAttribute
Now it is possible to compile the xsd.exe generated class and use it in net core
netstandard2.0 can compile xsd.exe generated files with no problems
There is no way actualy but if you see this it's a part of the future .net core release (.Net Core 1.2 release on Q2 2017).
If you want more Info, see this discuss and specially this point.
Related
I'm trying to add Linq-to-SQL data classes to Unity project but I get an error:
Assets\Scripts\DataClasses1.designer.cs(46,65): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I need to use Linq-to-SQL in my Unity project.
When I add System.Data.Linq.dll and System.Data.dll to my Plugins folder, I get these errors:
Loading assembly failed: "Assets/Plugins/System.Data.dll"
Loading assembly failed: "Assets/Plugins/System.Data.Linq.dll"
Does anybody know how I can use Linq-to-SQL in my Unity project?
I already set Unity-> Player->Api Compatibility Level->.net 4.x but it does not solve the problem.
I have seen references in documentation ( https://learn.microsoft.com/en-us/aspnet/core/fundamentals/file-providers?view=aspnetcore-2.1 ) to EmbeddedFileProvider and ManifestEmbeddedFileProvider as a way of accessing embedded resource files in my assembly via the IFileProvider interface, but when I try to use either of them I get "Error CS0246 The type or namespace name 'ManifestEmbeddedFileProvider' could not be found (are you missing a using directive or an assembly reference?)" and the only options in VS alt+enter menu are to generate the class.
I have already specified using Microsoft.Extensions.FileProviders; and PhysicalFileProvider is certainly available, but not the embedded ones.
If they are supposed to be usable in 2.1 how do I make them available to my project?
You need the following NuGet package: Microsoft.Extensions.FileProviders.Embedded.
I've got MVC.Net application in my TFS2015. My Applications builds & runs fine in Local. I'm configuring CI/Cd pipeline for this application. Please find the error specified below
Error CS0234: The type or namespace name 'WebApi' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
Error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)
I've tried both MSBUILD & Visual Studio Build tasks in my pipeline, still same error occurs
The type or namespace name 'WebApi' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
According to the error message, it seems you are missing the references when you build with Azure DevOps. You should add nuget installer tasks to restore the package:
NuGet Tool Installer task
When we build the project/solution on local machine, the packages is downloaded stored in the \packages folder, this folder is ignored by the source control (This is recommended.) when we submit our source code, so when we build the project/solution on the Azure DevOps, we need add nuget restore task to restore nuget package before we build it.
If you have already use nuget restore in your pipeline and still get that error, please share the warning info in your build log.
Hope this helps.
I've copied the missing dll's from
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\Facades
To
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2
Thanks #Leo Liu -MSFT for suggesting this article. It worked for me
I have downloaded the KinectToolbox from the codeplex website and added Kinect.Toolbox.dll into the reference in my project, but when I put "using Kinect.Toolbox" I get the error "The type or namespace "Toolbox" does not exist in the namespace 'Microsoft.Samples.Kinect' (are you missing an assembly reference?)"
Any suggestions?
I am getting an error:
Error 1 The type or namespace name 'Description' does not exist in the namespace 'System.Web.Http' (are you missing an assembly reference?) c:\users\klippiat\documents\visual studio 2010\Projects\TfsPortal\TfsPortal\Models\ApiModel.cs 5 23 TfsPortal
I would normally Add Reference and select the missing reference. But System.Web.Http.Description is missing from the list. I have sorted the list by name to make sure that I should be able to see it. I can see System.Web.Http.Data and .Common etc. but not the .Description one.
What am I doing wrong?
Visual Studio 2012 SPA Template /Help/index.cshtml file was throwing your error.
#using System.Web.Http
#using System.Web.Http.Description <=== CS0234: The type or namespace name 'Description' does not exist in the namespace 'System.Web.Http' (are you missing an assembly reference?)
Solution: Set "Copy Local : True" in properties for References\System.Web.Http
You aren't doing anything wrong. There is just some configuration problem that prevents Visual Studio from adding the reference to the list of assemblies for the compiler to check.
Types in the System.Web.Http.Description are found in the System.Web.Http.dll assembly, which is found in a Nuget package folder.
You can type Uninstall-Package Microsoft.AspNet.WebApi in the NuGet Package Console and then type Install-Package Microsoft.AspNet.WebApi to re-install it at which point, the reference will be fixed.
I un-installed MVC4 and reinstalled from a fresh download. I had to create a NEW project again and the Description namespace appeared.
The strange thing is if I open the old project the Description namespace is still missing when I try to add a using...
I was also facing the same issue when while creating a SPA solution by using MVC-4 framework.
I resolved this by setting the Copy Local : True in properties for the reference System.Web.Http.
I had the same problem. I was opening the project as a website instead of project/solution. So, after opening the solution it solved my problem.