BC30002 Error When Compiling VB Project with Microsoft.CodeAnalysis.Emit - vb.net

I'm using the Microsoft.CodeAnalysis.Emit to compile a Visual Basic project and generate .dll file with following compilation options.
VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Debug);
Following error is thrown by the emitter for all VB projects I tried to compile. Please advice how to resolve this.
vstest.executionengine.x86.exe Error: 0 : xxxxx -,
C:\Projects\xxxx\xxxxx\My Project\Settings.Designer.vb(67,48): error
BC30002: Type 'Global.xxxx.xxxx.Console.VBTestApp.My.MySettings' is
not defined.

To compile the generated Settings.Designer.vb file correctly, you have to set the root namespace of the project to the same one the file was generated with. In your case, that seems to be xxxx.xxxx.Console.VBTestApp, so your options should be:
new VisualBasicCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
optimizationLevel: OptimizationLevel.Debug,
rootNamespace: "xxxx.xxxx.Console.VBTestApp")

Related

SonarScanner CLI error: check sonar.projectKey and sonar.organization properties, SONAR_TOKEN variable

When using SonarScanner, following the suggested manual recipe for classic .NET and MSBuild - so all required properties and variable are passed to the CLI tool - I find the following error at the bottom lines:
ERROR: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator.
What's wrong? How to resolve this?

How Can I Clear A Kotlin Error in JavaFX?

I was trying to fix an error in a JavaFX program from an on-line course. In researching someone said moving a file cleared the error.
When I moved my todoItemDialog.fxml file it gave me this error even though Kotlin is not involved:
Error: Kotlin: The Kotlin standard library is not found in the module graph. Please ensure you have the 'requires kotlin.stdlib' clause in your module definition.
When I add the statement to my module-info.java tab in IntelliJ Idea is gives this error:
Module not found: kotlin.stdlib
I removed the requires statement and moved the todoItemDialog.fxml file back to it's original location but I still get the Kotlin error.
How can I clear the Kotlin error without starting over from the first line of code for this project?
I encountered this same error while running JavaFX code. Simply rebuilding the project will solve the error.
Build -> Rebuild Project

Errors Creating App Package (UWP, Appx) - fatal error CMF1106: failed to open input PDB file for reading

I'm getting errors when Creating App Packages for a UWP Win 10 application.
On my machine the error is:
C:\Users\Developer\.nuget\packages\nodatime\2.4.0\lib\netstandard2.0\NodaTime.pdb : fatal error CMF1106: failed to open input PDB file for reading (PDB error code = 11)3 input PDB file is not generated by /DEBUG:fastlinkW must read and agree to the Data Collection Policy at MSPDBCMF : fatal error CMF1000: internal error
The pdb file exists in the mentioned directory: C:\Users\Developer\.nuget\packages\nodatime\2.4.0\lib\netstandard2.0
On a hosted VSTS build the error message is even more cryptic:
C:\Users\VssAdministrator\.nuget\packages\nodatime\2.4.0\lib\netstandard2.0\NodaTime.pdb : fatal error CMF1106: failed to open input PDB file for reading (PDB error code = 11)3 input PDB file is not generated by /DEBUG:fastlinkW must read and agree to the Data Collection Policy at ??? before using /errorreport:send1 warning treated as error; the PDB file is intact# specified output filename is too long (exceeding 0 characters)
Note 1: On my machine the package is actaully successfully created but on the VSTS build the step fails as it detects the error in logs and stops.
Note 2: I'm pretty sure this is not NodaTime specific. This is about something else...
My msbuild switches are:
/p:AppxBundlePlatforms="$(BuildPlatform)"
/p:AppxPackageDir="$(Build.ArtifactStagingDirectory)\AppxPackages\"
/p:AppxBundle=Never
/p:UapAppxPackageBuildMode=StoreUpload
I am now trying with extra /p:DebugSymbols=false /p:DebugType=None, but even if it fails, I would like to understand and eliminate the 'fastlink' errors.
Explicitly setting DebugType to pdbonly worked in my case, but not sure if you need portable debug symbols or not, so this might not be an option for you.
<PropertyGroup>
<DebugType>pdbonly</DebugType>
</PropertyGroup>

Predefined type CallSite is defined in multiple locations

I get errors from both build and website precompile on App Harbor that seem to originate from multiple versions of the C# dynamic assemblies. They both start with warnings that look like:
2>CSC : warning CS1685: The predefined type 'System.Runtime.CompilerServices.CallSite' is defined in multiple assemblies in the global alias; using definition from 'd:\temp\qb3ydb5o.xoq\input\packages\IronJS.Core.0.2.0.1\lib\net40\Microsoft.Scripting.Core.dll' [D:\temp\qb3ydb5o.xoq\input\...csproj]
The build passes, but website precompile has these warnings but fails:
(0): error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember'
d:\temp\qb3ydb5o.xoq\output\_PublishedWebsites\...cshtml(4): error CS1969: One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?
I wonder if it has anything to do with how IronJS is packaged? Can someone help me troubleshoot this error?
I fixed this by removing references to Microsoft.Scripting.Core and Microsoft.Scripting.ExtensionAttribute. These were added by the IronJS NuGet package. I still have AppHarbor build errors, but those are because AppHarbor isn't doing a clean build (different problem).
Edit: I submitted an issue with IronJS: https://github.com/fholm/IronJS/issues/92

Team Build sends error when trying to compile a Structuremap method

I'm getting a strange error when trying to compile a solution that is using StructureMap on Team Build.
When I try to compile the solution locally on Visual Studio it works fine, but when trying to queue a new build in Team Build I get the following error:
Overload resolution failed because no accessible 'Use' can be called with these arguments:
The line of code that gets this error is the second one:
ForSingletonOf(Of ISessionFactory)().Use(NHibernateSessionFactory.SessionFactory)
Me.For(Of ISession)().lifecycleIs(New HybridLifecycle()).Use(Function(x) x.GetInstance(Of ISessionFactory)().OpenSession())
It's a standard registration for the NHibernate session, so I don't really get why this error pops up.
Thanks in advance for the clues.
Make sure you have the correct version of NHibernate on the build server, and that your hint paths are all appropriately set in your project file. We haven't had this specific issue (as we're not using NHibernate), but we've had weird issues like that being related to version mismatches of "infrastructure" DLLs between local and build.