简体   繁体   中英

VS 2017 c# Error CS0234 The type or namespace name does not exist in the namespace (are you missing an assembly reference?)

I have a Solution with multiple projects. I have correct build order and dependency. This project can be built on a different machine with the exact same version of Visual Studio 2017 (26430.13). The only difference is that, that currently I'm trying to build on Windows 10. The other system (which can build) is Win 8.1. But on a 3rd machine with Win 10 also builds.

My problem is the following on the system, that can't build the solution:

There is a project called ucx.v2 (namespace: pcbox). When I build this project, there is no error and it builds correctly.

There is another project called Timer. This project has a reference to ucx.v2 in the references. It's not broken. When I build this project, I get more than 100 errors, about reference errors.

The build order is correct, because when I build the Timer project, first it starts to build the ucx.v2 project, and finishes without any errors.

I've tried the following: - Restart VS. - Clean solution, rebuild project - Remove reference from Timer project, and add it again without any luck.

Note: I've copied the solution from the working machine.

Here is the error log:

1>------ Build started: Project: ucx.v2, Configuration: Debug Any CPU ------
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\forms\UcDataAdapter.cs(463,21,463,28): warning CS0108: 'UcDataAdapter.Dispose()' hides inherited member 'Component.Dispose()'. Use the new keyword if hiding was intended.
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\ras\RasConnectionNotify.cs(35,69,35,93): warning CS0618: 'WaitHandle.Handle' is obsolete: 'Use the SafeWaitHandle property instead.'
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\ras\RasConnectionNotify.cs(52,69,52,93): warning CS0618: 'WaitHandle.Handle' is obsolete: 'Use the SafeWaitHandle property instead.'
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\data\CommandBatch.cs(53,34,53,36): warning CS0168: The variable 'ex' is declared but never used
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\ras\RasConnection.cs(440,59,440,84): warning CS0618: 'WaitHandle.Handle' is obsolete: 'Use the SafeWaitHandle property instead.'
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\data\StoredProc.cs(58,13,58,16): warning CS0162: Unreachable code detected
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\data\StoredProc.cs(81,13,81,16): warning CS0162: Unreachable code detected
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\forms\UcColorButton.cs(23,17,23,49): warning CS0184: The given expression is never of the provided ('KnownColor') type
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\data\QueryOptimizer.cs(258,18,258,26): warning CS0219: The variable 'sendflag' is assigned but its value is never used
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\forms\Print\ReportToolbar.cs(119,30,119,32): warning CS0168: The variable 'ex' is declared but never used
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\forms\UcDataSetManager.cs(1172,37,1172,39): warning CS0168: The variable 'ex' is declared but never used
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\forms\Print\frmReportPreview.Designer.cs(140,56,140,64): warning CS0169: The field 'frmReportPreview.Command0' is never used
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\ras\frmGetConnection.cs(22,44,22,54): warning CS0649: Field 'frmGetConnection.components' is never assigned to, and will always have its default value null
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\forms\MemoryStatisticsGparh.cs(33,13,33,30): warning CS0414: The field 'MemoryStatisticsGparh.graphMaxItemCount' is assigned but its value is never used
1>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\forms\MemoryStatisticsGparh.cs(32,13,32,22): warning CS0414: The field 'MemoryStatisticsGparh.lineCount' is assigned but its value is never used
1>  ucx.v2 -> c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\bin\Debug\ucx.v2.dll
2>------ Build started: Project: Timer, Configuration: Debug Any CPU ------
3>------ Build started: Project: pcbox.startpage, Configuration: Debug Any CPU ------
4>------ Build started: Project: Loader.run, Configuration: Debug Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3258: The primary reference "c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\bin\Debug\ucx.v2.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\AlarmNotification.cs(6,13,6,17): error CS0234: The type or namespace name 'data' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\IScheduledServiceItem.cs(2,13,2,17): error CS0234: The type or namespace name 'data' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\pop3\RxMailMessage.cs(17,13,17,22): error CS0234: The type or namespace name 'Extension' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\ServiceTimer.cs(8,13,8,17): error CS0234: The type or namespace name 'data' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\ServiceTimerDS.cs(4,13,4,17): error CS0234: The type or namespace name 'data' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\synchronization\MailReceiver.cs(7,13,7,17): error CS0234: The type or namespace name 'data' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\synchronization\MailSender.cs(8,13,8,17): error CS0234: The type or namespace name 'data' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\synchronization\Replication.cs(6,7,6,18): error CS0246: The type or namespace name 'ICSharpCode' could not be found (are you missing a using directive or an assembly reference?)
2>c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\Timer\synchronization\Replication.cs(7,13,7,17): error CS0234: The type or namespace name 'data' does not exist in the namespace 'pcbox' (are you missing an assembly reference?)

I believe your issue is due to this line here:

2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3258: The primary reference "c:\Users\david\Documents\Visual Studio 2017\Projects\NomalGit\ucx.v2\bin\Debug\ucx.v2.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

In the project named Timer, change the .NET target version from 2.0 to 4.0 by opening project properties and changing "Target Framework."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question CS0234 C# The type or namespace name 'Slydeextender' does not exist in the namespace (are you missing an assembly reference?) Error CS0234 The type or namespace name 'Reporting' does not exist in the namespace 'Microsoft' (Are you missing an assembly reference?) error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) Error CS0234 The type or namespace name 'Platforms' does not exist in the namespace 'MvvmCross' (are you missing an assembly reference?) error CS0234: The type or namespace name does not exist in the namespace (are you missing an assembly reference?) error CS0234: The type or namespace name 'OAuth' does not exist in the namespace 'Microsoft.Owin.Security' (are you missing an assembly reference?) Compiler Error Message: CS0234: The type or namespace name 'WebApp' does not exist in the namespace 'Fax' (are you missing an assembly reference?) CS0234: The type or namespace name '<namespace2>' does not exist in the namespace '<namespace1>.' (are you missing an assembly reference?) CS0234: The type or namespace name 'Description' does not exist in the namespace 'System.Web.Http' (are you missing an assembly reference?) MEF CS0234: The type or namespace name 'Composition' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM