在Visual Studio代码项目中访问本地生成的DLL

时间:2016-10-08 12:58:22

标签: visual-studio-code roslyn .net-core

所以我在我的Mac OSX上建立了一个文件夹中的roslyn CommonNetCoreReferences_DoNotUse.dll* CommonNetCoreReferences_DoNotUse.pdb* Microsoft.CodeAnalysis.CSharp.dll* Microsoft.CodeAnalysis.CSharp.pdb* Microsoft.CodeAnalysis.CSharp.xml* Microsoft.CodeAnalysis.dll* Microsoft.CodeAnalysis.pdb* Microsoft.CodeAnalysis.xml* Microsoft.DiaSymReader.Native.amd64.dll* Microsoft.DiaSymReader.Native.x86.dll* Microsoft.Win32.Primitives.dll* Microsoft.Win32.Registry.dll* System.AppContext.dll* System.Collections.Concurrent.dll* System.Collections.Immutable.dll* System.Collections.dll* System.ComponentModel.DataAnnotations.dll* System.Console.dll* System.Core.dll* System.Diagnostics.Debug.dll* System.Diagnostics.FileVersionInfo.dll* System.Diagnostics.Process.dll* System.Diagnostics.StackTrace.dll* System.Diagnostics.Tools.dll* System.Diagnostics.Tracing.dll* System.Dynamic.Runtime.dll* System.Globalization.Calendars.dll* System.Globalization.Native.dylib* System.Globalization.dll* System.IO.Compression.Native.dylib* System.IO.Compression.dll* System.IO.FileSystem.Primitives.dll* System.IO.FileSystem.Watcher.dll* System.IO.FileSystem.dll* System.IO.Pipes.dll* System.IO.dll* System.Linq.Expressions.dll* System.Linq.dll* System.Native.a* System.Native.dylib* System.Net.Http.Native.dylib* System.Net.NameResolution.dll* System.Net.Primitives.dll* System.Net.Sockets.dll* System.Net.dll* System.Numerics.dll* System.ObjectModel.dll* System.Private.CoreLib.dll* System.Private.CoreLib.ni.dll* System.Private.Uri.dll* System.Reflection.Emit.ILGeneration.dll* System.Reflection.Emit.Lightweight.dll* System.Reflection.Emit.dll* System.Reflection.Extensions.dll* System.Reflection.Metadata.dll* System.Reflection.Primitives.dll* System.Reflection.TypeExtensions.dll* System.Reflection.dll* System.Resources.ResourceManager.dll* System.Runtime.Extensions.dll* System.Runtime.Handles.dll* System.Runtime.InteropServices.RuntimeInformation.dll* System.Runtime.InteropServices.dll* System.Runtime.Loader.dll* System.Runtime.Numerics.dll* System.Runtime.Serialization.dll* System.Runtime.dll* System.Security.Claims.dll* System.Security.Cryptography.Algorithms.dll* System.Security.Cryptography.Cng.dll* System.Security.Cryptography.Csp.dll* System.Security.Cryptography.Encoding.dll* System.Security.Cryptography.Native.dylib* System.Security.Cryptography.OpenSsl.dll* System.Security.Cryptography.Primitives.dll* System.Security.Cryptography.X509Certificates.dll* System.Security.Principal.Windows.dll* System.Security.Principal.dll* System.ServiceModel.Web.dll* System.ServiceModel.dll* System.Text.Encoding.CodePages.dll* System.Text.Encoding.Extensions.dll* System.Text.Encoding.dll* System.Text.RegularExpressions.dll* System.Threading.Overlapped.dll* System.Threading.Tasks.Extensions.dll* System.Threading.Tasks.Parallel.dll* System.Threading.Tasks.dll* System.Threading.Thread.dll* System.Threading.ThreadPool.dll* System.Threading.dll* System.Windows.dll* System.Xml.Linq.dll* System.Xml.ReaderWriter.dll* System.Xml.Serialization.dll* System.Xml.XDocument.dll* System.Xml.XPath.XDocument.dll* System.Xml.XPath.dll* System.Xml.XmlDocument.dll* System.Xml.dll* System.dll* corerun* csc* csc.cmd csc.exe* csc.exe.config* csc.pdb* csc.xml* libclrjit.dylib* libcoreclr.dylib* libdbgshim.dylib* libmscordaccore.dylib* libmscordbi.dylib* libsos.dylib* mscorlib.dll* mscorlib.ni.dll* pbcopy sosdocsunix.txt*

以下是我收到的文件列表

SMS Manager API

现在我如何在Visual Studio Code中使用它? 我如何引用本地DLL?

1 个答案:

答案 0 :(得分:3)

.Net Core项目可以通过两种方式引用依赖项:

  1. NuGet包
  2. 项目到项目参考
  3. 值得注意的是,缺少直接引用程序集。

    这意味着您有两种选择:

    1. 构建Roslyn NuGet包,将它们放入一个目录中,并使用NuGet.Config为您的.Net Core项目将该目录配置为包源。然后正常引用包。
    2. 使用global.json将相关的Roslyn项目作为解决方案的一部分,然后使用"target": "project"将它们作为项目引用,而不是在project.json中指定包的版本。