.net-standard-2.0

.NET Core, .NET Standard and Transitive Dependencies across Solutions

こ雲淡風輕ζ 提交于 2019-12-05 15:46:28
My question is similar to this one , although it doesn't really address my issue. I am working on some new AWS Lambda functions, and I would like to keep their implementation in separate class libraries for reuse. I'm testing this concept using two solutions: A solution with a single .NET Standard class library project. This class library has a reference to HTML Agility Pack. A solution with a single .NET Core 2.0 console application project. Class library: using System; using HtmlAgilityPack; namespace ClassLibrary1 { public class Class1 { public static bool FoundDotNet(string html) { bool

Missing Method Exception When Referencing .Net Standard Project From .Net 4.6.1 Unit Test

。_饼干妹妹 提交于 2019-12-05 02:23:14
I am getting the following exception when running a .Net 4.6.1 unit test that uses System.IO.Compression.ZipFile.Open , if the unit test project references a .Net Standard 2.0 assembly: System.MissingMethodException: Method not found: 'System.IO.Compression.ZipArchive System.IO.Compression.ZipFile.Open(System.String, System.IO.Compression.ZipArchiveMode)'. at UnitTestProject.UnitTest1.TestMethod1() The unit test project was created using the VS 2017 Unit Test project (not the .NET Core one) and references were added to System.IO.Compression.FileSystem and my standard class library: using

Copy all dependencies from .Net Standard libraries to .Net Framework Console application

偶尔善良 提交于 2019-12-04 10:59:21
问题 After consuming .net standard projects in a .net framework(4.6) console application, the dependencies of the .net standard projects are not copied into the output directory. This results in run time error of missing dlls. The "copy local" property is already true for the referenced projects. One possible solution is to add all the dependencies again in the console application, but is not a good idea. Is there a better solution to this? 回答1: After going through an article by Scott Hanselman,

Copy all dependencies from .Net Standard libraries to .Net Framework Console application

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 08:09:13
After consuming .net standard projects in a .net framework(4.6) console application, the dependencies of the .net standard projects are not copied into the output directory. This results in run time error of missing dlls. The "copy local" property is already true for the referenced projects. One possible solution is to add all the dependencies again in the console application, but is not a good idea. Is there a better solution to this? After going through an article by Scott Hanselman, below solution worked like a charm. Add below line in the first "PropertyGroup" tag of the .net framework

Roslyn, MSBuildWorkspace compiling a .NetStandard project referencing a .NetStandard project throws “No value for RuntimeMetadataVersion found.”

我的未来我决定 提交于 2019-12-02 07:12:05
Create a solution with the following projects. A .NetStandard2.0 project, name it "1" A .NetStandard2.0 project, name it "2" Add a reference of project 1 in 2 A .Net4.6.1 console project name it "3" and add the nuget Microsoft.CodeAnalysis.CSharp.Workspaces v2.7.0 Paste in the follwing code into project 3 static void Main(string[] args) { string dir = Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\"); string solutionPath = Directory.GetFiles(dir, "*.sln").First(); var msWorkspace = MSBuildWorkspace.Create(); Solution solution = msWorkspace.OpenSolutionAsync(solutionPath).Result;

Error indexing method 'Class.Method' Cannot bind parameter 'log' to type TraceWriter

我的未来我决定 提交于 2019-12-02 06:40:49
问题 I have "upgraded" a bunch of my Azure Functions to .netstandard 2.0 and I get the following error: Error indexing method 'Class.Method' Cannot bind parameter 'log' to type TraceWriter. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.). Following the answer to that question, I

Reference .netstandard 2.0 project in core 2.0 Runtime loading error when GenerateAssemblyInfo = false

ⅰ亾dé卋堺 提交于 2019-12-02 03:36:08
When we add the reference, we are able to use the .netstandard libs classes in our .net core console project (in Visual Studio), and it compiles. When we run the app, it immediately crashes with this error in the output window: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module. Could not load file or assembly 'MyNetStandard20Assembly, Version=0.1.0.0, Culture=en-us, PublicKeyToken=null'. The system cannot find the file specified. Update / Cause (still looking for reason) So we use AssemblyInfo files in our projects and in order to make these work with

Adding .NET Standard libraries to 4.7.1 lib adds loads of references, some broken

雨燕双飞 提交于 2019-11-30 08:33:56
问题 As I need to import a library targeting .NET Standard 2, I had upgraded my library to .NET 4.7.1, as I understood from this MS video that should avoid this issue: https://www.youtube.com/watch?v=u67Eu_IgEMs However, adding .NET standard now results in dozens of System.xxx references, rather than a single reference to .NET Standard (as per the video). Worse still, several of the references have been added but the underlying file appears to be missing generating warnings, e.g. Warning The

Trying to set-up Entity Framework core in .Net Standard project

一曲冷凌霜 提交于 2019-11-30 06:40:50
问题 I was wondering if I could set-up my EntityFrameworkCore in a .NET Standard 2.0 project easily. I was following this Tutorial but it requires either .NET Core or Framework. When I got to this step: Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models I got this error: Startup project 'projectName' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects

VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

懵懂的女人 提交于 2019-11-30 01:47:04
I'm getting Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'. in VSTS build using Hosted2017 build agent after I upgraded my aspnetcore app to netcoreapp2.0 and my libraries to use netstandard2.0 . Works fine locally. I've edited my build definition to use .net core build task v2.* preview : here is the build log: Current agent version: '2.120.2' Download all required tasks. Downloading task: DotNetCoreCLI Starting: Get Sources Syncing repository: Liero/vyvojari-sk (GitHub) ...details ommited HEAD is now at e448a25... Upgraded to .NET Core 2.0 Finishing: Get