Visual Studio Online can't locate function in class in class library on build server - vb.net

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!

Related

Debug .NET com dll when running from Access

I have a com dll developed in VB.net that provides an interface to eBay api's. Been working for many years. Recently eBay change certificate authority and moved to TLS 1.2. Sorted through that but now the dll seems to quit in mid transaction when called from Access. The functionality does listings from local inventory to eBay. The first part loads pictures of the listing item to eBay. That works fine. I can see the calls and responses using Fiddler. It then moves on to actually listing the item which seems to stop when called from Access. What I get back in Access is "Can't find x.dll at file location". I know the call is going to the dll because it uploads the pictures.
I have a test project developed in VB.net to test the dll and when run from that everything works. I can see the listing call and response in fiddler. When run from Access there is no listing call. I can verify that the endpoints for the calls are the same from test project or Access.
My question is how to debug the dll in the Visual Studio IDE when it is called from Access. Any thoughts?
Yes, the way you do this is open up the vs class you have for the .dll.
Then in debug of the project, setup this:
Now, when you hit f5, then access will launch and run.
If at this point, say you close access (exit), then you note the debugging process stops.
However, go though the forms and whatever in Access, and get to the point where you hit that button or whatever.
You find now that you can say set a break point and even step and debug your .net code like any other code. So say in my example (a custom sage 300 .net interface to access), I want to debug "find customer" routine from VBA.
Well, in vb.net I have this code:
so, when any routine - even those in the class instances is called, you can set break-points etc.
And to stop? Just exit access.
So, you can make a change to your code, and even hit f5.
It not clear how you are registering your .dll (or do you use some VBA to side-load the .net - that's what I do, since it is a pain to have to register my .net com objects on each PC.
But, do give the above a try. It should let you debug your .dll code. The trick is to have VS launch ms-access as a attached debug session - and that is exactly what the above setting in your class project above allows you to do.
do note in above, I used the path to access 2010 (access 14), so replace the path name to the access.exe with your version of access you are using.
And keep in mind, that if have some installer, or some custom "thing" that registers your .net .dll for you?
Well, during this process, if your VBA assumes a registered com object, then ensure you have this check box enabled:
On compile for the project settings, you thus want this option checked:
NOTE very careful, checking the above option does not change the code or anything at all - it ONLY does a regasum automatic for you, and this would of course re-register your existing .dll - which is what we want for debugging. After you done, do run your re-register of your .dll to switch back from the debug .dll that going to be in your current project bin folder to whatever you "regular" use on your PC.
FYI:
In MOST cases, I find this whole idea does NOT work unless you launch VS as administraor. So, make sure VS is being run as administraor for this to work.
I tend to just tap windows key, or even right click on your vs shortcut, and of course choose run as administraor.
This is so often required, you note that VS will EASY and quite CLEAR show you running in admin mode, and I quite much now always run VS this way.
You should see this:

Compiled Access Program Runs Fine on 7 Computers but Crashes on 3 others

I have written a rather complex application in Microsoft Access. It is split into front end and back end files. To protect my code, I have compiled it and saved it as a runtime .accde file, which I then changed to an .accdr file to ensure it operated as a runtime. I have created two versions of the application: one for those with 32-bit Office installed and one for those with 64-bit office. I have used Inno Setup to package the application, the data file, and other files such as the icon file, the license file, etc., into an installable package, which works just fine.
Among my team of 27 beta testers of this application, so far 6 have downloaded it, and I have tested it on four of my own computers. On seven of these computers, the installation works perfectly and the application runs with no problems.
On the computers of three of my testers, when they try to run it, they get this error message:
The expression On Open you entered as the event property setting produced the following error: Bad file name or number.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
I'm pretty sure I know where the code is that's causing the problem, but cannot for the life of me figure out why the application crashes on those 2 computers but not on others.
The On Open event I suspect of causing the problem checks the linked tables, gets their connect string, then looks at the path for that string for the back end database. If it does not find it there, the procedure pops up a file selector dialog and instructs the user to find the data file, then it relinks all the tables.
If anyone could point me in the right direction to fixing this problem, I would be extremely grateful.
This is typically caused by a reference labelled as MISSING.
You have two (three) options:
Run the application on the offending machines with a full version of Access that lets you debug the code
Create a small test application that lists and verifies the references you use, and run this on the offending machines
Remove those two customers
Thanks to all the contributors here. Because of these folks and additional online research, the latest answer I can find is this:
This error occurs on a small percentage of computers on which the app is installed, and no one has yet figured out why, what causes it, or how to fix it. The workaround is to install the 2013 version of the Access runtime, as later versions will still cause the problem.
At least one of the offending computers is running the Click-to-Run version of Office. Still gathering information, but that's the status as of now.

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.

Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute is not defined?

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...

Workspace.PendEdit not checking out files

I'm using the TFS 2010 SDK to programmatically check in edits to files into TFS 2010. The documentation on the TFS 2010 SDK is sparse at best. When I call the method workspace.pendedit() passing in an array of files I want to mark as having a pending edit, nothing is actually checked out. So when I call workspace.checkin() passing in workspace.getpendingchanges and some comments I get an exception that there must be at least one thing that has a pending change (which should be what I passed into pendedit). Any thoughts on why the app isn't marking the files as having a pending edit in the workspace?
Make sure you're doing everything in the right order so TFS knows that the file has changed. You have to:
Get the file from the workspace first.
Pend the edit
Make the changes to the file
Check in the workspace.
Example:
GetStatus status = workspace.Get(new GetRequest(migrationPath, RecursionType.None,
VersionSpec.Latest),GetOptions.Overwrite);
workspace.PendEdit(migrationPath);
checkInAuthor = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
It turned out that even though I had added the files and checked in the files, it seemed that the workspace didn't recognize that the files were there, and as a result I had to do a Get() prior to the PendEdit()