Why does build fail with the error - Type or namespace name '' could not be found in the global namespace - c#

I am trying to build a project using visual studio as well as MSBuild.exe. When the code is built using visual studio, there are no issues and the build runs successfully, but when built through MSBuild.exe, the following error is thrown - "The type or namespace name 'eCom' could not be found in the global namespace". This error is being recorded from various lines in the code, couple of the erroneous lines have been written below:
protected global::eCom.Web.DataViewExtender view3Extender;
and
using eCom.Web;
The dll for 'eCom' is successfully getting created on the server.
Recently dot net framework 4.6.2 was installed on the build server, I wonder if that has anything to do with the error.

Related

SSIS with c# script Task referencing a custom dll where namespace has a dot in it

I have an SSIS with a script task (C#). This package works when running locally (Visual Studio 2015) but does not when running as sql job (SSISDB integration services catalog). The error is "Script Task:Error:CS0246 - The type or namespace name 'work' could not be found (are you missing a using directive or an assembly reference?), ScriptMain.cs, 217, 35"
ScriptMain.cs line 217 is
var process = new work.Provision.Provisioner(bla bla);
The assembly reference is there as a dll (the filename is work.Provision.dll). The good guy who built this dll left the company. The namespace is "work.Provision". Could it be that the SSIS is confused and expecting a namespace called "work"?
How do I solve this?
We do have the source code and probably needs to rework it so the namespace is "workProvision" (remove the dot) to avoid confusion - maybe, I don't know I'm not an expert. Keep in mind this whole thing works when I run it locally on Visual Studio (2015).
Many thanks!

Error code:CS2021 (File name 'C:" /debug- /optimize+ C:\svo2trpm.0.cs' is too long or invalid) While creating assembly using CODEDOM

I am trying to create an assembly using CODEDOM. The assembly am creating will contain a POCO class and the properties that this class will carry will be coming from Database. Everything is going fine , but while trying to create assembly out of the codecompliationunit, I am getting the below error.
Error code:CS2021 (File name 'C:" /debug- /optimize+ C:\svo2trpm.0.cs' is too long or invalid) While creating assembly using CODEDOM.
I am using .net framework 4.5 with Visual Studio 2019 on Windows 7. I tried to run the same code on a windows server 2016 and still the same issue.

Visual studio Class not found exception and namespace not found

Im having an issue where my c# program builds and compiles successfully but fails at runtime. It gives this exception whenever i run it.
Im also getting "type or namespace not found" for my LinkExplorer dll (during runtime) but im able to reference it and it doesnt give me any error when compiling / building. Why is it giving namespace not found when the namespace clearly exists? I also tried build target = x64 and x86 but still gives the same error. My .NET is 4.0 which is the same as this dll's.
In project properties -> Build tab, you need to mark your project to be registered for COM interop:
and in Application tab, click Asembly information... and at the bottom of a pop up check:

c# project with CI build - reference to Oracle extension causes build error

I have a C# app build in MS VisualStudio (2015) and it's checked in to a VisualStudio repository hosted for the company I work for.
I defined a 'Build' profile on the VisualStudio server with 'Continuous Integration' on, so it builds every time there's a check in.
It's been working fine until now...
I had to add some code that called an Oracle Server, so in my code I have
OracleConnection conn = new OracleConnection(connString);
...
and at the top
using Oracle.ManagedDataAccess.Client;
and in my Project I did:
Add > Reference > Assemblies > Extensions > Oracle.ManagedDataAccess
so, it all builds and runs on my development PC.
On the TeamFoundationServer however, the build fails now with message
Error CS0246: The type or namespace name 'Oracle' could not be found (are you missing a using directive or an assembly reference?)
on the using line of the source file.
I assumed that the server would include the Oracle extension because it's now referenced in the project file (which is checked in). Is there another step I need to take?
The assemblies listed in the Extensions list are ones provided by extensions you've installed into Visual Studio (my guess is you've installed the 'Oracle Developer Tools for Visual Studio' extension).
Because this extension hasn't been installed on your build server (and nor should it) the build server naturally complains that it can't find the reference.
The solution is to remove the reference you've added an instead add a reference to the NuGet package containing the Oracle driver. This looks to be the correct one: https://www.nuget.org/packages/Oracle.ManagedDataAccess/
Your build server will then fetch the NuGet package as it would for any other assembly.

c# Wrapper for CNTK steps

I'm having some issues at running CNTK on c# wrapper. I see rold2007 had success on doing the same thing. There got to be something simple that I missed. Any advice would be greatly appreciated.
The steps I used are as follow:
use the source code from C#
generate a new dos application and copy the new code to it.
building the program, the following error occurred at line
using (var model = new IEvaluateModelManagedF())
Wit error message:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'IEvaluateModelManagedF' could not be found (are you missing a using directive or an assembly reference?)
VS version: vs community 2015
OS: windows 10.
CNTK: Downloaded binary. Able to run a sample program.
Your project needs to reference EvalWrapper.dll. In the same directory as the DLL, you need to have a list of other DLLs that are used. See the detailed discussion on the CNTK GitHub page. If you are running a CPU-only build, this is the list of DLLs:
EvalDll.dll
EvalWrapper.dll
libacml_mp_dll.dll
libifcoremd.dll
libifportmd.dll
libiomp5md.dll
libmmd.dll
Math.dll
svml_dispmd.dll
Update
CNTK has switched from ACML to Intel MKL as of August 2016 (see Release Notes). After this change, the list of required DLLs is
EvalDll.dll
EvalDll.lib
EvalWrapper.dll
Math.dll
libiomp5md.dll
mkl_cntk_p.dll

Categories

Resources