VB.Net Sublime Text 2 Build Error - vb.net

I am trying to find a good build system or fix a possible error with my current build system. Whenever I run the following code:
Option Explicit On
Option Strict On
Module EmployeeBonus2
Sub Main
' Declare and initialize variables here
Dim numOne as Integer = 10
System.Console.WriteLine(10)
System.Console.Read()
End Sub
End Module
I get the following error
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
Is there anyway to fix this? I am using the MSBuild package to attempt to build this in Sublime Text 2. Its a .VB file, so should I make my own build system and if so, how?

Download Visual Studio Community edition (it is free) then create a VB.Net project.
You can get it here:
https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx
Once you have the project structure and files created, you can use Sublime Text to edit the .vb files and use MSBuild from the command line to compile the project.
The code file(s) will end in .vb and the project file will end in .vbproj.
Once you have Visual Studio installed it will probably be easier to just edit and compile your code within Visual Studio. Visual Studio also gives you a debugger.
Use the 'F5' function key to compile and run your code from Visual Studio.

Related

Visual basic compiler error: Type 'SCU' is not defined

I am trying to compile a VB class into .netmodule, it refers to a motor control ActiveX file with namespace SCU
My command is:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Vbc.exe /t:module motorFunc.vb
But the compiler shows those errors:
Any suggestions?
The ActiveX reference to SCU will be a part of your .vbproj project file, not the .vb code file, so you can't just compile the .vb file by itself as it doesn't know how to find the reference from there.
I'm a little confused why you are compiling from the command line rather than just using Visual Studio. If you do want to build from the command line, I suggest you use MSBuild to build the whole project and not just the individual file.

Build error when signing with snk key

Build error is occurring since using Visual Studio 2015. When building in Visual Studio 2015 this is occurring rarely. When building in TeamCity this occurs very often.
[Error in Visual Studio 2015]
Error extracting public key from file 'CompanyName.snk': The process cannot access the file 'C:\Users\UserName\AppData\Local\Temp\tmp2FF6.tmp' because it is being used by another process. CompanyName.Project.DAL D:\Projecten\CompanyName\Repository\Source\Components\CompanyName.Project.DAL\vbc
http://i.stack.imgur.com/hKbbe.png
[Error in TeamCity]
CSC error CS7027: Error signing output with public key from file 'CompanyName.snk' -- The process cannot access the file 'C:\BuildAgents\Gamma\temp\buildTmp\tmpD91D.tmp' because it is being used by another process.
http://i.stack.imgur.com/rbgHx.png
I know it's been a while since this was asked but as I use SO for my own reference and I had this problem too I wanted to share my solution.
.snk files are for signing a project. You might need to make a new one.
Right click on your project, select properties.
Click on Signing.
Click the checkbox beside "Sign the assembly".
On the dropdown labelled "Choose a strong name key file" click new.
Fill in the dialog box as you wish noting particularly the Key file name. When you press ok, this will generate a new .snk file.
Save the project and rebuild.
This will use the new .snk in your project and will resolve the
error.
Hope this helps.
Try to clean up the temp folder that is used by the build.
I have seen different types of problems when the temp folder has lots of files.
Some of the tools are using GetTempFileName and they will get errors when temp has a lots of files
The GetTempFileName method will raise an IOException if it is used to create more than 65535 files without deleting previous temporary files.
This is probably an instance of this issue with Roslyn compiler. The workaround would be adding
<UseSharedCompilation>False</UseSharedCompilation>
under any <PropertyGroup> node in .csproj file.
It started for me when I moved the Resharper Cache to System Temp. When I moved it back to the Solution folder, the problem went away, and I could build again.
I just had the same problem. In Visual Studio 2015, I fixed it using the following steps:
Go to Tools > Options
From the Options dialog, select "Projects and Solutions > Build and Run"
Set the "maximum number of parallel project builds" to 1
+1 to #stukselbax for getting me on the right track
Also got help from this link
I used '/m:1' as an msbuild argument, and 'SignPublic' property to true in the csproj file.
Just had this issue today in visual Studio 2022- I was messing with the csproj file and ended up having the wrong filepath to the snk file. I fixed it by changing the filepath to be correct.
Right-click on the project -> unload (so that you can edit the csproj file)
Under <PropertyGroup> check the <AssemblyOriginatorKeyFile> tag
My code was:<SignAssembly>true</SignAssembly> <AssemblyOriginatorKeyFile>../NAMEHERE.snk</AssemblyOriginatorKeyFile> NAMEHERE was specific to my project, yours will vary. Look at your snk file. The ../ in front will vary, check the filepath of your snk file. If you caused this error by messing with your csproj file, like I did, then the correct answer is what the filepath was before you changed it. :)
Right-click on the project -> reload

Can Orchard 1.8.x be installed on a build server that does not have Visual Studio Installed?

I also asked this question on the Orchard forum but no joy there yet. So here it is again...
https://orchard.codeplex.com/discussions/569444 Please read for a few more details.
IF the .NET 4/4.5 SDK came with a developer command prompt (like previous SDKs) then I would not be asking this question.
But since Orchard is build with .NET 4.5 I am getting build errors using the old SDK. It seems that my only option is to install Visual Studio Express on the build server.
I am doing that as we speak so at this point the question is purely academic but I am still curious.
EDIT
STILL NO JOY. Even after installing VS 2013 Express Web the vcvarsall.bat that usually configure the build environment is still not present. So this is no longer a curiosity question. The Express edition also cannot create my build environment. Help.
Seth
Here is my answer...copied and pasted from the forum.
This is a late answer. Bottom line is that I did eventually get our build server to build orchard projects. I am not sure if this is a complete answer or not as I should have answered as soon as I had it done. But I pretty sure this will work.
One other thing to note...It is quite possible that not all of these steps are required. I tried a lot of different things and it might be in the end some of the steps were not needed. It might also reflect a problem on our build server...especially the fact that I had to manually add registry entries.
But here it is without details.
Install the .NET Framework SDK for Windows 7.1.
http://www.microsoft.com/en-us/download/details.aspx?id=8279
Install the .NET 4.5 Full
http://www.microsoft.com/en-us/download/details.aspx?id=30653
Install Visual Studio 2013 Express for Web
http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
Install the Visual Studio 2013 Build Tools
http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
Finally, even after that...it didn't work until I added the following registry keys. I would attach the .reg file but I don't see how.
Save the lines between the lines into a fixBuild.reg file. Then double click...
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7]
"FrameworkDir32"="C:\Windows\Microsoft.NET\Framework\"
"FrameworkDir64"="C:\Windows\Microsoft.NET\Framework64"
"11.0"="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\"
"FrameworkVer32"="v4.0.30319"
"FrameworkVer64"="v4.0.30319"
"12.0"="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\"
Finally, to actually do the build, I created a batch file that does the build.
Save the lines between the lines into a doBuild.cmd file. Be sure to place this in the root of the source download...then double click to build...
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
msbuild /t:FastBuild Orchard.proj
The first line gets your environment ready. The second build the project using the FastBuild target in the Orchard.proj file. You can read that file if you want to try other build targets.
******* EDIT
There is one thing I forgot to mention. And that is that one thing you have to do to get this to work is that you have to edit some CSPROJ files because the command line build fails with errors like these...
\Orchard\src\Orchard.Web\Modules\CKEditor\CKEditor.csproj(337,6): error : "None" element name for include "Placement.info" should be "Content".
\Orchard\src\Orchard.Web\Modules\Orchard.Tokens\Tests\Orchard.Tokens.Tests.csproj(82,6): error : "None" element name for include "app.config" sh
\Orchard\src\Orchard.Web\Modules\TinyMceDeluxe\TinyMceDeluxe.csproj(377,6): error : "None" element name for include "app.config" should be "Cont
\Orchard\src\Orchard.Web\Modules\Upgrade\Upgrade.csproj(156,6): error : "None" element name for include "app.config" should be "Content". [C:\Us
\Orchard\src\Orchard.Web\Themes\Themes.csproj(280,6): error : "None" element name for include "Upward\Views\Content-Story.Detail.cshtml" should
The fix is to do exactly what the error indicates. Open the csproj files and search/replace "
Also, some of the projects reference app.config files that do not exist in source. You also have to remove those references. I usually just delete the content node entirely or the group entirely.
Seth

Loading specific test file for debugging MSProject Add-In

I am developing a MSProject add-in with VSTO and I have a question about debugging.
How do I use the Start Option->Command line arguments to load a specific MS Project file?
I have tried using [drive:][path]filename.mpp but the file doesn't load.
Otherwise everything is fine. I can load a file manually and debug properly.
Thanks for any assistance.
You can use the following command line example to load MS Project with a specific MPP file:
winproj "c:\projects\Annual Report Preparation.mpp"
For Visual Studio Project->Debug->Start Options->Command Line arguments - you can use the path enclosed in quotations. The gotcha here is that you must also assign the Start Action->Start External program for this to work - this is a VS bug.
"c:\projects\Annual Report Preparation.mpp"
Use ... and set Start External Program (depending on your Office version):
C:\Program Files (x86)\Microsoft Office\Office15\WINPROJ.EXE
See MS Office for further MS Project command line reference.

Building coded ui test project fails when "Perform runtime contract checking" is set to "full"

I have a simple Test project where a CodedUITestMethod is created. The test method simply clicks the Windows Start button in the taskbar. The method is generated by the Coded UI Test Builder tool from Visual Studio 2010 Ultimate.
Then, I go to project's Properties page, Code Contracts tab.
Check the Perform Runtime Contract Checking check box.
Change the value of Contract Reference Assembly combo box to "Build".
Now I hit F6 to build the project and receive the 2 errors:
Reading assembly 'Microsoft.VisualStudio.TestTools.UITesting' resulted in errors.
C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets (240,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ ccrewrite" "#CodedUITest_Contract2ccrewrite.rsp"" exited with code -1.
I have uploaded my project zip file to my codeplex project
Could someone download the project and see if they can reproduce the compile error? Thanks.
The problem is solved. It appears that Microsoft.VisualStudio.TestTools.UITesting.dll references another dll that is not added into the project.
Add Microsoft.VisualStudio.TestTools.UITest.Playback.dll in the folder C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\ solves the issue.
Thanks to David K Allen who answered the question on the msdn forum.