我正在制作一个使用asp.net核心后端的Xamarin Forms应用程序。我想到了创建一个可移植的类库,然后由app和asp.net核心项目引用。但是,当我尝试运行asp.net核心项目时,一切都出错了。当我运行dotnet运行时,我遇到了很多错误。我无法弄清楚为什么会发生这种情况,因为在Visual Studio本身中没有出现这种情况
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\API>dotnet run
Project ClassLibrary (.NETPortable,Version=v4.5,Profile=Profile259) will be compiled because expected outputs are missing
Compiling ClassLibrary for .NETPortable,Version=v4.5,Profile=Profile259
C:\Program Files\dotnet\dotnet.exe compile-csc @C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\obj\Debug\portable45-net45+win8+wp8+wpa81\dotnet-compile.rsp returned Exit Code 1
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\obj\Debug\portable45-net45+win8+wp8+wpa81\dotnet-compile.assemblyinfo.cs(2,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\obj\Debug\portable45-net45+win8+wp8+wpa81\dotnet-compile.assemblyinfo.cs(3,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(9,12): error CS0246: The type or namespace name 'AssemblyTitleAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(9,12): error CS0246: The type or namespace name 'AssemblyTitle' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(10,12): error CS0246: The type or namespace name 'AssemblyDescriptionAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(10,12): error CS0246: The type or namespace name 'AssemblyDescription' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(11,12): error CS0246: The type or namespace name 'AssemblyConfigurationAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(11,12): error CS0246: The type or namespace name 'AssemblyConfiguration' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(12,12): error CS0246: The type or namespace name 'AssemblyCompanyAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(12,12): error CS0246: The type or namespace name 'AssemblyCompany' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(13,12): error CS0246: The type or namespace name 'AssemblyProductAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(13,12): error CS0246: The type or namespace name 'AssemblyProduct' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(14,12): error CS0246: The type or namespace name 'AssemblyCopyrightAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(14,12): error CS0246: The type or namespace name 'AssemblyCopyright' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(15,12): error CS0246: The type or namespace name 'AssemblyTrademarkAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(15,12): error CS0246: The type or namespace name 'AssemblyTrademark' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(16,12): error CS0246: The type or namespace name 'AssemblyCultureAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(16,12): error CS0246: The type or namespace name 'AssemblyCulture' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(17,12): error CS0246: The type or namespace name 'NeutralResourcesLanguageAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(17,12): error CS0246: The type or namespace name 'NeutralResourcesLanguage' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(29,12): error CS0246: The type or namespace name 'AssemblyVersionAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(29,12): error CS0246: The type or namespace name 'AssemblyVersion' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(30,12): error CS0246: The type or namespace name 'AssemblyFileVersionAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(30,12): error CS0246: The type or namespace name 'AssemblyFileVersion' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\obj\Debug\portable45-net45+win8+wp8+wpa81\dotnet-compile.assemblyinfo.cs(2,67): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\obj\Debug\portable45-net45+win8+wp8+wpa81\dotnet-compile.assemblyinfo.cs(3,62): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(9,26): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(10,32): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(11,34): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(12,28): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(13,28): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(14,30): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(15,30): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(16,28): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(17,37): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(29,28): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(30,32): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(1,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(2,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(3,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Properties\AssemblyInfo.cs(4,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Hello.cs(3,18): error CS0518: Predefined type 'System.Object' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Hello.cs(5,16): error CS0518: Predefined type 'System.String' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Hello.cs(5,36): error CS0518: Predefined type 'System.Void' is not defined or imported
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\ClassLibrary\Hello.cs(6,9): error CS0518: Predefined type 'System.Void' is not defined or imported
Compilation failed.
0 Warning(s)
45 Error(s)
Time elapsed 00:00:00.7651735
C:\Users\arnva\OneDrive\Apps\Xamarin\Drivr\API>