VisualStudio 2013 weird compile issues - vb.net

Issue
I'm having some really odd compile issues using Visual Studio 2013 and it's really disrupting my teams workflow.
The issue is hard to explain but I will provide screen shots and code snippets to help people understand the problems we are facing.
We have a project that we recently moved to VisualStudio 2013 from 2010 and upgraded it to .Net 4.5, the project is a ASP.net Web Forms project.
The code compiles and runs but oddly when I change any of the class files sometimes even just adding a comment 'Test Comment it fails to compile.
The errors shown in the error window are all wierd and the IntelliSense shows errors in the wrong place, some of the errors are even completly off. An example is _To is not defined in the line Dim _Town as String or in the same line 'ring' is not defined which is oviously part of the word String
ScreenShots
Here are some of the errors after I added the failing code at line 44 and then commented it out and re-compiled
What I've tried
I've tried to change the files line endings and make sure they are all Windows CR+LF, I've tried snooping in the build output nothing I can really see to help me.
I even brung the solution down from source control on another machine to test and it had the same issue. It didn't actually compile properly at all on the new machine but I don't know yet if these two issues are related.

I had the same issue as yours, and also the same scenario (I had upgraded a very old VB.NET project to a 2013 project).
The issue seem to be related to file encoding. I don't know the exact cause, but it might be having multiple files with different encoding (In my case, some files were ANSI, other files were UTF-8 w/ BOM).
If you aren't sure about having files with different encoding, open them in Notepad++. You should see the file encoding in the bottom-right corner.
At first, I have convert the offending file to ANSI to see if this will resolve the problem. I opened the offending file in Notepad++, selected Encoding-Convert to ANSI, Saved, Encoding->Encode In UTF-8 without BOM, Saved and Reloaded the file in VS. Now the project compile successfully.
However, I didn't want to do this every time I changed the file, (since VS convert it back to UTF8), therefore I copied all the old files (In my case they were 4 files only) to a temporary directory, deleted the files from VS and created new files with the same name, and I copy/pasted the content into each file. Now all my files are in UTF8, and I am no longer having this issue.
The solution is to either convert your files to ANSI as UTF8, or convert them to UTF8 (This seems to be the default encoding for newly created files in Visual Studio, so I suggest converting them to UTF8)
If you have a lot of files I think you can try to convert them to UTF8 using Notepad++.
Regards.

Related

How do I make an ACCDE file when the original project is too large

I have a client who needs to ensure that the system cannot be compromised from a 'disgruntled employee' - ie taking a copy of the 'front end' (the data is not a problem, it is the actual workings and coding that needs to be secured.
The current system is too large to make an ACCDE file (40,000kb).
I have tried reducing, compacting etc. No Joy
I also tried creating a brand new copy and re-importing all modules and objects. No Joy
I then tried creating a blank database with only 1 form and some code to undertake the importing of the objects. The code worked fine.
The file with just the form and code worked in creating the ACCDE file but the code then failed to run as it is 'transferring objects' and ACCDE files will not allow that.
Are there any alternatives to solve the original problem?
Thank you
When you are creating ACCDE file, be sure to check if project is compilable:
After this, you'll get errors, that prevents you to create ACCDE file.
Other point is that if you are using other files as source libraries (through References), then you should compile them also. ACCDE would accept only ACCDE files as Access files as library sources.
Anyway, just try first solution, it should help you as I think. Because 40 Mb - not a size for ACCDE. Only limitations I know: not more than 1000 objects in database, not more 2 Gb database size for 32 bit Access.
Van Ng - Thank you.
I missed the obvious - after checking if the project using 'Compile Project...' I found some old, redundant code that I had left in with a variable that had not been declared.
I have fixed that and it compiled.
Problem Solved - many thanks.

A reference to 'C:\Solver32.DLL' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component

Still green when it comes to programming, so bear with me. I'm currently trying to create a program in Visual Studio 2017 (VB.NET) intended to make modifications to a paired Excel spreadsheet using the Solver add-on. I've successfully created a reference for the Excel reference library but am unable to do so for the Solver reference library. I've tried creating references for both SOLVER32.DLL and SOLVER.XLAM, but both produce the same general error message:
"A reference to 'C:\xxxx.(DLL/XLAM)' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
I've browsed for hours looking for viable solutions, some of which seem to suggest repackaging the .DLL file (use of TlbImp.exe) through use of CMD and Native Tools CMD for VS (run as Admin), but that hasn't generated success (generated following error: "The input file 'C:\xxxx.DLL' is not a valid type library.") Some of the posts I've read on linking the Solver suggest the .XLAM file is specifically what needs to be used, but that hasn't generated any success, either.
I've reinstalled Microsoft Office (both x32-bit and x64-bit), reinstalled Solver multiple times, completely closed and reopened Excel with each Solver reinstall.
If it should help, I'm using an updated version of Microsoft Excel 2016 (now x64-bit) and running Windows 10 (also x64-bit, of course). The file path for Solver is MicrosoftOffice\root\Office16\Library\Solver. I've tried linking the files while Excel is open as well as when it is closed.
I've tried switching gears and using Solver Foundations instead (for which I can successfully create a reference), but there doesn't seem to be a compatible command for my project (or at least one I can wrap my head around; I'm looking for the equivalent of 'SolverOK.'
Any help here would be greatly appreciated -- starting to lose my mind over this!

Auto generated Swift.h file keeps being not found

A number of times now the auto generated Swift.h file that's required to use swift code in objective-c is not being found.
I've removed and reinstalled Xcode. Made sure all the correct boxes for it to be generated are checked and that I'm using #objc on Swift classes.
Sometimes it works fine but then there are significant periods where for an unknown reason its no longer able to find that file.
The app does build successfully, but the editor after building claims the file is missing.
The project this is being used in has multiple targets but I've made sure that the Swift.h file is using the same name in all targets.
At this point it seems there is no way to consistently have the file be available for auto completion purposes.
Any suggestions on what else to try would be appreciated as I'm at a loss.
After seeing this issue occur randomly a number of times I discovered that I needed to build all the targets for this app. Doing that meant that the -Swift.h file that was missing was now available.
I had one target that I wasn't building as that app which was part of the project wasn't being actively worked on, but building that was the solution to the problem.

Source files constantly getting appended with garbage when saving on USB drive/stick

I'm a hardware/software developer and prefer to keep my source files on an external USB drive or thumbdrive. The problem I've been facing for years it seems is when I try to save these files. When I save a file and then compile I occasionally get syntax errors on lines that don't even exist in my source. For example it will complain about line 83 when my source file is only 80 lines long. Lets say I have the file open in a particular editor (I prefer Programmers Notepad or Notepad++) and see only 80 lines... I can save but then if I pop open the same file in parallel using something like Wordpad sure enough... I see the extra lines and it looks like the last few lines of real code got munged and then appended to the end of the file.
At first I thought it was the editor but have found that no matter what editor I use it happens fairly frequently. I recently upgraded to a new laptop and OS (From Win7 to Win10) and lo and behold the same problem exists here. Tried different USB drives/sticks.... same deal. Am I missing something??? This problem has been driving me bonkers! :P

VB.Net embedded Flash Object creates problems

Ì have had this problem in a number of projects and I have almost given up. I am sure there is a solution though. When I insert a Flash object in a VB.Net Windows Forms application, it works fine for a little while and then I see this error in the Design Screen. I am using Visual Studio 2010
Could not load file or assembly 'Interop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I have read several descriptions of why this happens, and apparently it has something to do with strong naming (or lack thereof), but have not found a solution yet. I used Add Reference->COM->Shockwave Flash (C:\Windows\SysWOW64\Macromed\Flash\Flash32_11_2_202_235.ocx) If I ignore the error it appears to work fine, but I don't want my users to have a problem.
I know I can use a browser control and play the Flash in that, but for reasons I won't get into, I have to use a Flash control. Any ideas would help.
Okay. I can't promise this to work for you, but it worked for me.
First, you have to locate a file on your computer titled AxImp.exe. You have to run it from the command prompt. This file is located (for me at least) here:
C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\x64
Once you do find and run it, you have to point it to the correct Flash.ocx file you're using, like so:
AxImp.exe <path>\Flash.ocx
Once you've done that you should end up with 2 DLL files in the same directory as the .ocx file. One called AxShockwaveFlashObjects.dll and another called ShockwaveFlashObjects.dll.
You don't care about ShockwaveFlashObjects.dll, just AxShockwaveFlashObjects.dll.
Grab that file and the Flash*.ocx file and paste them into the project directory.
Then include them into your references. This should open up two new references, AxShockwaveObjects and ShockwaveObjects.
Make sure you're Using both of them.
After this, you have to register the Flash*.ocx using RegSvr32 from your command prompt (make sure to run CMD in admin mode). That is done like so:
C:\RegSvr32 <path>\Flash.ocx
This worked for me. I was having the exact same problem (which is what led me here). It could be a half backed hack workaround but for now, that's how it worked for me.
Let me know if it works for you or not.
Hope it goes well for you.
I know this is an old post but I had this issue yesterday and the solution, at least in my case, was very simple. All I had to do was to change the Platform and Platform Target to x86 (Build tab of project property).