Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute is not defined? - vb.net

I'm attempting to create a new project similar to the SDK project basicoperations for Dynamics CRM 2011. I am using the myorganizationcrmsdktypes.vb file included with the SDK helper code, but when I attempt to build the code I get tons of errors in myorganizationcrmsdktypes.vb and I'm not sure why. The errors look like this:
Type 'Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute' is not defined.
The code works fine when run in the original project, just not in mine?

Add a reference to: Microsoft.Xrm.Sdk (/sdk/bin/microsoft.xrm.sdk.dll)
Also add another reference to: System.Runtime.Serialization
Additionally in your project settings - try clearing the Root namespace

Have you tried your code on a different machine? This is less of a CRM issue and more of a .net issue. If your vb project has a reference to the Microsoft.Xrm.Sdk dll but yet your code can't find the classes within it, I'm almost wondering if something is corrupt.
I'd try recreating the solution / project. I'd also try doing a ctrl-. (control period) to see if VS can resolve it for you...

Related

The system cannot find the reference specified

I've created project in VB 2019, was working ok. But due to some problem, I formated my PC & re-installed all the software. Now I realize that path of all the references I used in my project are missing and it shows "The system cannot find the reference specified".
Pls help how to resolve this issue.
You can just remove a reference and then re-add it from the appropriate location. You can do it all from the References page of the project properties or you can remove them in the Solution Explorer first. I'd suggest taking a screenshot first, so that you won't forget any.

Migrating videosoft vsindextab from VB6 to VB.NET

I have a VB6 project I need to migrate to VB.NET.
I tryied with both the migrating tool of VB.NET express 2005 and 2008 with the same result.
When I try to open a form in designer mode containing a videosoft's vsindextab component in the resulting project of the migration, I receive the following error:
Warning 1 Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) C:\gestionbtdotnet\FormBT.Designer.vb 261 0
The line in error is in the designer.vb file and is the following:
CType(Me.vsIndexTab1, System.ComponentModel.ISupportInitialize).BeginInit()
(The vsIndexTab being a vsOcx6lib.vsindextab object)
I searched all over the web about it but couldn't find anything.
I tryied using a different .NET Framework version, I tryied copying the ocx file (vsocx6.ocx) to every possible places, I tryied simply erasing the line in error.
No luck.
Can anyone help me?
You can only migrate code. Projects that depend on third-party components that are binary-only and not .Net compatible (like the vsindextab component used here) will not migrate. Here are your options:
Check with the original vendor for a .Net version of the same component.
Find another .Net-compatible replacement for the component, and re-write code to use the new replacement.
Rewrite existing code to avoid using the component anywhere at design time. Factor that section out to it's own library that you can invoke at run-time only. Then build custom dllimport code to use that library at run time.
Write your own replacement for the component, relying on existing .Net widgets.

Visual Studio Online can't locate function in class in class library on build server

Hi I'm getting an error in the VSO log and a build failure
d:\a\src-***--\r2rJSONcall.aspx.vb (31): 'rptJSONRoutesTable' is not
a member of 'r2rSearchResponse'.
And yet it is!
r2rJSONcall.aspx.vb
Public Class r2rJSONcall
...
Property r2rResponse As New r2rSearchResponse
...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'call the webservice..
...
Response.Write(r2rResponse.rptJSONRoutesTable("EUR"))
and in a classlibrary..
Public Class r2rSearchResponse
...
Function rptJSONRoutesTable(userCurrencyCode) As String
It, of course, runs locally no problem.
I've tried making a one byte change and recommitting, also the associated DLL was under source control, so I removed and add that. No Joy.
UPDATE - no, bad news the answer I posted below solved the problem temporarily. It has reared its ugly head once more and no matter what can't seem to get a build to work.
The following procedures have been tried so far to get a VSO online build to compile correctly:
1) I deleted my local folders and performed a full checkout from sourcecontrol - suggested by #MetaFight. That compiles fine locally, no files missing.
2) Excluded the /Bin and /Obj folders. So no dll's checked into source as suggested by #PhilipKendall
3) Run MSBuild locally. The solution compiles OK.
4) Renamed, and then moved function inside the classlib to try to trigger rebuild on Azure server. Still can't find the function.
5) Checked build order, Classlib is compiled first. "Clean" option selected on Build Profile.
6) Checked that references are correct. I can see the reference in the vbproj file. The reference are Project references, not file references.
7) Deleted Build Profile in Azure/VSO. Created new build defintition profile and new Web App in Azure - error reappears.
8) Tried this solution Library/Static Method not Updating in Azure No Merge error like point 3) on that page.
Any TFS/VSO experts out there can help?
We working in a small team and new member with no VSO experience has come onboard. He's working on the frontside AJAX, JSON, CSS, HTML5 - no need to use the classlibs or anything else - just submitting his code via TFS.
I suspected he might be an issue, so fixed up remote access and went in. He'd not updated Windows 7 since new - around 4 years. "Never had a BSOD" was the response. He was trying to install IIS which the machine wasn't very happy about it, so could not test locally, I don't know what the webserver in Visual Studio was doing - his system was not in English. Anyway I right-clicked where I would have done on the English version and did a recursive pull - then clicked on what looked like the Pending Changes and did a checkin.
Success - solution built OK.
I told my programmer to delete Visual Studio and never do a checkout again on that PC - and am providing him a remote desktop with fully patched machine and software.
You can do one of the following methods:
1) Did you check "Enable Nuget Package Restore" for your project?
You can use the following documentation for doing that:
http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages
Or:
2) Read the source below, it may help you if first method is not applicable for you or don't help:
http://blog.codingoutloud.com/2013/08/31/are-you-missing-an-assembly-reference-why-yes-i-am-so-kind-of-you-to-ask/
I hope both offered method support your question.
Apologies for not coming back sooner.
As discussed the problem came back even though it did manage to build after checkin from the rogue programmer, it subsequently went back to not building.
In the end we renamed the classlib (by right clicking and rename). Then checked the references to that classlib from all the other projects that require it. There was one subproject that on "add.. reference..." did not have the checkbox on, but in Properties of the project and references did. So this must have re-established the line in the vbproj file correctly.
Congo we build!

Could not load type 'System.Data.Entity.Core.Mapping.EntityContainerMapping'

When I debug the following code, I receive the message "System.TypeLoadException was caught" when I perform the Delete().
Using db As New ScholarshipEntities
db.ApplicationHistories.Where(Function(h) h.HistoryTypeId = 0).Delete()
db.SaveChanges()
End Using
I am using EF 6.1 in Visual Studio 2013. I also have the EntityFramework.Extended library installed.
I have no trouble querying results. I thought the bug might occur when the Where method has no results, but that is not the case. I also have no problem adding new models (.edmx), which was a problem some people with this exception had.
I just recently upgraded to EF 6.1 and installed the Extended library. This is my first time using one of the extended methods. I've un-installed and re-installed the nuget packages with no success.
IntelliTrace shows the following exceptions from the Delete() call (in order):
'EntityFramework.Reflection.DynamicProxy' does not contain a definition for 'InternalQuery'
Cannot implicitly convert type 'EntityFramework.Reflection.DynamicProxy' to 'System.Data.Entity.Core.Objects.ObjectQuery<Scholarship.ApplicationHistory>'
Could not load type 'System.Data.Entity.Core.Mapping.EntityContainerMapping'
I've added an issue on the Extended library's github.
Update
I've reinstalled EF and the EF.Extended library with no luck. I am able to use RemoveRange in its place. I am able to create a new project, install the packages, add a model mapped to the same database, and successfully use Delete. Obviously, the problem is in my current solution.
In my solution, I have an ASP.NET project and a regular library project. In the ASP project, a page's code behind calls a method in the library RemoveHistory. The library contains classes for the business logic and data access. Both classes implement interfaces. The actual Delete occurs in the data access class. My model also resides in this library project.
I may be able to create a completely new project and bring everything over, but that will take quite some time. Even if I did, I want to understand why it doesn't work in the first place, so that I don't have to repeat this process.
If you want to delete certain rows do it like that:
Using db As New ScholarshipEntities
db.ApplicationHistories.RemoveRange(db.ApplicationHistories.Where(Function(h) h.HistoryTypeId = 0))
db.SaveChanges()
End Using
If you want to remove single entity do it like that:
Using db As New ScholarshipEntities
db.ApplicationHistories.Remove(db.ApplicationHistories.Single(Function(h) h.HistoryTypeId = 0))
db.SaveChanges()
End Using
I "solved" the issue some time ago. I'll eventually go back to try and reproduce the problem to confirm my suspicions.
There were multiple versions of Entity Framework installed in the solution. This didn't appear to affect basic EF functionality, though I'm sure it did in some subtle, potentially buggy fashion.
Every time the solution was opened, NuGet would state that it couldn't complete uninstallation. Uninstalling and restoring via NuGet was unsuccessful, and the packages had to be deleted manually. Once completely removed, I installed the packages again. This resolved the issue.
I wish I could give a more technical answer, though the basic reason was forgetting to look closer at the packages folder and configuration.

Converted old C++ project into VS 2010 project. Getting error

The "CppClean" task was not given a value for the required parameter "FoldersToClean"
There is exactly one web page in The Google that discusses this error's source, as of this writing:
http://msdn.microsoft.com/en-us/library/ee862481.aspx
It sounds like the DEVENV auto-upgrader for old workspaces, solutions, and projects does not successfully handle this old C++ project of yours.
Is there any output in the Upgrade.XML files relating to it?
The CppClean task was not given a value for the required parameter FoldersToClean error occurs if the project's Output Directory or Intermediate Directory are empty or contain a macro that yields an empty or otherwise invalid result.
Specify $(Configuration) or perhaps <inherit from parent or project defaults> to solve this.
via EatMyRandom Blog.