dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.07k forks source link

Dependencies don't flow from new NETStandard project to old Desktop projects through ProjectReferences #901

Closed weshaggard closed 6 years ago

weshaggard commented 7 years ago

Copied from https://github.com/dotnet/corefx/issues/14565.

From @jnm2

Am I doing something incorrect? I was not sure if this is the same problem as the other problems I've had with netstandard. Just by luck, every single one of my forays into netstandard have failed with this same type of issue. I have great confidence that it's just me and these will all be fixed by VS2017's RTM.

Create a new .NET Standard library targeting netstandard1.3. Create a static method Class1.DoWork() that throws new Win32Exception(). Add a .NET Framework console app targeting net462 In Program.cs, call Class1.DoWork() and add a reference to the library project. Run the console app and get:

System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source=NetstandardLibrary
StackTrace:
at NetstandardLibrary.Class1.Works() in C:\Users\Joseph\documents\visual studio 2017\Projects\NetstandardOnDesktop\NetstandardLibrary\Class1.cs:line 10
at DesktopConsoleApp.Program.Main(String[] args) in C:\Users\Joseph\documents\visual studio 2017\Projects\NetstandardOnDesktop\DesktopConsoleApp\Program.cs:line 9

Is this a binding redirect issue or something? I hope this isn't the way things are intended to be? As long as this type of error exists, can you please maintain a netstandard troubleshooting document with step-by-step guidance for the workaround?

I would hope that scenarios like this would be covered by integration tests.

https://github.com/jnm2/misc-codesamples/raw/master/Bug%20reports/.NET/NetStandard%20Win32Exception%20causes%20file%20not%20found.zip

From @weshaggard

Looking at his solution the issue stems from the fact that the ProjectReference from the DesktopConsoleApp to the NETStandardLibrary project isn't flowing the dependencies correctly so it isn't seeing Microsoft.Win32.Primitives at all. It isn't even an issue with binding redirects in this case it is just a missing dependency. To workaround it you can add a reference to the Microsoft.Win32.Primitives nuget package to the DesktopConsoleApp. However this sounds like a tooling issue where dependencies aren't flowing.

weshaggard commented 7 years ago

In case it is interesting here is the ResolveAssemblyReferences output from the log.

ResolveAssemblyReferences output from log 2>Target "ResolveAssemblyReferences: (TargetId:115)" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets" from project "C:\temp\14565\DesktopConsoleApp\DesktopConsoleApp.csproj" (target "ResolveReferences" depends on it): 2>Added Item(s): 2> _ReferenceInstalledAssemblyDirectory= 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\ 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\ 2>Set Property: ResolveAssemblyReferencesStateFile=obj\Debug\DesktopConsoleApp.csprojResolveAssemblyReference.cache 2>Added Item(s): 2> _ResolveAssemblyReferencesApplicationConfigFileForExes= 2> App.config 2> OriginalItemSpec=App.config 2> TargetPath=DesktopConsoleApp.exe.config 2>Set Property: ResolveAssemblyReferencesSilent=false 2>Set Property: ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch=Warning 2>Removed Item(s): Reference=System.Core 2>Added Item(s): 2> Reference= 2> System.Core 2> Implicit=true 2>Task "ResolveAssemblyReference" (TaskId:73) 2> Task Parameter: 2> Assemblies= 2> System 2> System.Xml.Linq 2> System.Data.DataSetExtensions 2> Microsoft.CSharp 2> System.Data 2> System.Net.Http 2> System.Xml 2> System.Core 2> Implicit=true (TaskId:73) 2> Task Parameter: 2> AssemblyFiles= 2> C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> BuildReference=true 2> Configuration=Debug 2> FullConfiguration=Debug|AnyCPU 2> MSBuildSourceProjectFile=C:\temp\14565\NetstandardLibrary\NetstandardLibrary.csproj 2> MSBuildSourceTargetName=GetTargetPath 2> Name=NetstandardLibrary 2> OriginalItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OriginalProjectReferenceItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OutputItemType= 2> Platform=AnyCPU 2> Project={0FE233C8-525C-49D7-A630-3A0B64676D8A} 2> ReferenceOutputAssembly=true 2> ReferenceSourceTarget=ProjectReference 2> SetConfiguration=Configuration=Debug 2> SetPlatform=Platform=AnyCPU 2> SetTargetFramework=TargetFramework=netstandard1.3;ProjectHasSingleTargetFramework=true 2> TargetPlatformIdentifier=Windows 2> TargetPlatformMoniker=Windows,Version=7.0 2> Targets= 2> UndefineProperties=;TargetFramework;ProjectHasSingleTargetFramework 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll (TaskId:73) 2> Task Parameter: 2> TargetFrameworkDirectories= 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\ 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\ (TaskId:73) 2> Task Parameter:CandidateAssemblyFiles=App.config (TaskId:73) 2> Task Parameter: 2> SearchPaths= 2> {CandidateAssemblyFiles} 2> {HintPathFromItem} 2> {TargetFrameworkDirectory} 2> {AssemblyFoldersFromConfig:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\AssemblyFolders.config,v4.6.1} 2> {Registry:Software\Microsoft\.NETFramework,v4.6.1,AssemblyFoldersEx} 2> {AssemblyFolders} 2> {GAC} 2> {RawFileName} 2> bin\Debug\ (TaskId:73) 2> Task Parameter: 2> AllowedAssemblyExtensions= 2> .winmd 2> .dll 2> .exe (TaskId:73) 2> Task Parameter: 2> AllowedRelatedFileExtensions= 2> .pdb 2> .xml 2> .pri 2> .dll.config 2> .exe.config (TaskId:73) 2> Task Parameter:TargetProcessorArchitecture=msil (TaskId:73) 2> Task Parameter:AppConfigFile=App.config (TaskId:73) 2> Task Parameter:AutoUnify=True (TaskId:73) 2> Task Parameter:SupportsBindingRedirectGeneration=True (TaskId:73) 2> Task Parameter:FindSatellites=True (TaskId:73) 2> Task Parameter:FindSerializationAssemblies=True (TaskId:73) 2> Task Parameter:FindRelatedFiles=True (TaskId:73) 2> Task Parameter:Silent=False (TaskId:73) 2> Task Parameter:TargetFrameworkVersion=v4.6.1 (TaskId:73) 2> Task Parameter:TargetFrameworkMoniker=.NETFramework,Version=v4.6.1 (TaskId:73) 2> Task Parameter:TargetFrameworkMonikerDisplayName=.NET Framework 4.6.1 (TaskId:73) 2> Task Parameter:TargetedRuntimeVersion=v4.0.30319 (TaskId:73) 2> Task Parameter:StateFile=obj\Debug\DesktopConsoleApp.csprojResolveAssemblyReference.cache (TaskId:73) 2> Task Parameter:FullTargetFrameworkSubsetNames=Full (TaskId:73) 2> Task Parameter:FullFrameworkFolders=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\ (TaskId:73) 2> Task Parameter:WarnOrErrorOnTargetArchitectureMismatch=Warning (TaskId:73) 2> TargetFrameworkMoniker: (TaskId:73) 2> .NETFramework,Version=v4.6.1 (TaskId:73) 2> TargetFrameworkMonikerDisplayName: (TaskId:73) 2> .NET Framework 4.6.1 (TaskId:73) 2> TargetedRuntimeVersion: (TaskId:73) 2> v4.0.30319 (TaskId:73) 2> Assemblies: (TaskId:73) 2> System (TaskId:73) 2> System.Xml.Linq (TaskId:73) 2> System.Data.DataSetExtensions (TaskId:73) 2> Microsoft.CSharp (TaskId:73) 2> System.Data (TaskId:73) 2> System.Net.Http (TaskId:73) 2> System.Xml (TaskId:73) 2> System.Core (TaskId:73) 2> AssemblyFiles: (TaskId:73) 2> C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll (TaskId:73) 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll (TaskId:73) 2> CandidateAssemblyFiles: (TaskId:73) 2> TargetFrameworkDirectories: (TaskId:73) 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\ (TaskId:73) 2> InstalledAssemblyTables: (TaskId:73) 2> IgnoreInstalledAssemblyTable: (TaskId:73) 2> False (TaskId:73) 2> SearchPaths: (TaskId:73) 2> {CandidateAssemblyFiles} (TaskId:73) 2> {HintPathFromItem} (TaskId:73) 2> {TargetFrameworkDirectory} (TaskId:73) 2> {AssemblyFoldersFromConfig:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\AssemblyFolders.config,v4.6.1} (TaskId:73) 2> {Registry:Software\Microsoft\.NETFramework,v4.6.1,AssemblyFoldersEx} (TaskId:73) 2> {AssemblyFolders} (TaskId:73) 2> {GAC} (TaskId:73) 2> {RawFileName} (TaskId:73) 2> bin\Debug\ (TaskId:73) 2> AllowedAssemblyExtensions: (TaskId:73) 2> .winmd (TaskId:73) 2> .dll (TaskId:73) 2> .exe (TaskId:73) 2> AllowedRelatedFileExtensions: (TaskId:73) 2> .pdb (TaskId:73) 2> .xml (TaskId:73) 2> .pri (TaskId:73) 2> .dll.config (TaskId:73) 2> .exe.config (TaskId:73) 2> AppConfigFile: (TaskId:73) 2> App.config (TaskId:73) 2> AutoUnify: (TaskId:73) 2> True (TaskId:73) 2> CopyLocalDependenciesWhenParentReferenceInGac: (TaskId:73) 2> True (TaskId:73) 2> FindDependencies: (TaskId:73) 2> True (TaskId:73) 2> TargetProcessorArchitecture: (TaskId:73) 2> msil (TaskId:73) 2> StateFile: (TaskId:73) 2> obj\Debug\DesktopConsoleApp.csprojResolveAssemblyReference.cache (TaskId:73) 2> InstalledAssemblySubsetTables: (TaskId:73) 2> IgnoreInstalledAssemblySubsetTable: (TaskId:73) 2> False (TaskId:73) 2> TargetFrameworkSubsets: (TaskId:73) 2> FullTargetFrameworkSubsetNames: (TaskId:73) 2> Full (TaskId:73) 2> ProfileName: (TaskId:73) 2> (TaskId:73) 2> FullFrameworkFolders: (TaskId:73) 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\ (TaskId:73) 2> LatestTargetFrameworkDirectories: (TaskId:73) 2> ProfileTablesLocation: (TaskId:73) 2> Primary reference "NetstandardLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null". (TaskId:73) 2> Resolved file path is "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll". (TaskId:73) 2> Reference found at search path location "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll". (TaskId:73) 2> Found related file "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.pdb". (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll". (TaskId:73) 2> Reference found at search path location "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll". (TaskId:73) 2> This reference is not "CopyLocal" because it's in a Frameworks directory. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Primary reference "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.winmd", but it didn't exist. (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Dependency "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:73) 2> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll". (TaskId:73) 2> Reference found at search path location "{TargetFrameworkDirectory}". (TaskId:73) 2> For SearchPath "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3". (TaskId:73) 2> Considered "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\System.Runtime.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\System.Runtime.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\System.Runtime.exe", but it didn't exist. (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Runtime.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Runtime.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Runtime.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.winmd", but it didn't exist. (TaskId:73) 2> Required by "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll". (TaskId:73) 2> This reference is not "CopyLocal" because it's a prerequisite file. (TaskId:73) 2> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:73) 2> Dependency "Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:73) 2> Could not resolve this reference. Could not locate the assembly "Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. (TaskId:73) 2> For SearchPath "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3". (TaskId:73) 2> Considered "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> For SearchPath "{TargetFrameworkDirectory}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> For SearchPath "{AssemblyFoldersFromConfig:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\AssemblyFolders.config,v4.6.1}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SqlDb\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SqlDb\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SqlDb\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.5\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.5\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.5\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.5\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.5\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.5\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.6.1,AssemblyFoldersEx}". (TaskId:73) 2> Considered AssemblyFoldersEx locations. (TaskId:73) 2> For SearchPath "{AssemblyFolders}". (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> For SearchPath "{GAC}". (TaskId:73) 2> Considered "Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", which was not found in the GAC. (TaskId:73) 2> For SearchPath "bin\Debug\". (TaskId:73) 2> Considered "bin\Debug\Microsoft.Win32.Primitives.winmd", but it didn't exist. (TaskId:73) 2> Considered "bin\Debug\Microsoft.Win32.Primitives.dll", but it didn't exist. (TaskId:73) 2> Considered "bin\Debug\Microsoft.Win32.Primitives.exe", but it didn't exist. (TaskId:73) 2> Required by "C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll". (TaskId:73) 2> AssemblyFoldersEx location: "{Registry:Software\Microsoft\.NETFramework,v4.6.1,AssemblyFoldersEx}" (TaskId:73) 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\MSBuild\v14.0 (TaskId:73) 2> C:\Program Files (x86)\Microsoft Web Tools\ReferenceAssemblies\14.0\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ReferenceAssemblies\v4.5\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.5\Prototyping\Libraries\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.5\Libraries\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft WCF Data Services\5.6.4\bin\.NETFramework\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ReferenceAssemblies\v4.0\ (TaskId:73) 2> (TaskId:73) 2> C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Prototyping\Libraries\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries\ (TaskId:73) 2> C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ReferenceAssemblies\v2.0\ (TaskId:73) 2> C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\\PublicAssemblies (TaskId:73) 2> C:\Program Files (x86)\Microsoft Chart Controls\Assemblies (TaskId:73) 2> C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\ (TaskId:73) 2> Output Item(s): 2> ReferencePath= 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=Microsoft.CSharp 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll 2> Version=4.0.0.0 2> C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> BuildReference=true 2> Configuration=Debug 2> CopyLocal=true 2> FullConfiguration=Debug|AnyCPU 2> FusionName=NetstandardLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 2> ImageRuntime=v4.0.30319 2> MSBuildSourceProjectFile=C:\temp\14565\NetstandardLibrary\NetstandardLibrary.csproj 2> MSBuildSourceTargetName=GetTargetPath 2> Name=NetstandardLibrary 2> OriginalItemSpec=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> OriginalProjectReferenceItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OutputItemType= 2> Platform=AnyCPU 2> Project={0FE233C8-525C-49D7-A630-3A0B64676D8A} 2> ProjectReferenceOriginalItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> ReferenceOutputAssembly=true 2> ReferenceSourceTarget=ProjectReference 2> ResolvedFrom=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> SetConfiguration=Configuration=Debug 2> SetPlatform=Platform=AnyCPU 2> SetTargetFramework=TargetFramework=netstandard1.3;ProjectHasSingleTargetFramework=true 2> TargetPlatformIdentifier=Windows 2> TargetPlatformMoniker=Windows,Version=7.0 2> Targets= 2> UndefineProperties=;TargetFramework;ProjectHasSingleTargetFramework 2> Version=1.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> Implicit=true 2> OriginalItemSpec=System.Core 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Data.DataSetExtensions 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Data 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Net.Http 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Xml 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Xml.Linq 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 (TaskId:73) 2> Output Item(s): 2> _ResolveAssemblyReferenceResolvedFiles= 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=Microsoft.CSharp 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll 2> Version=4.0.0.0 2> C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> BuildReference=true 2> Configuration=Debug 2> CopyLocal=true 2> FullConfiguration=Debug|AnyCPU 2> FusionName=NetstandardLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 2> ImageRuntime=v4.0.30319 2> MSBuildSourceProjectFile=C:\temp\14565\NetstandardLibrary\NetstandardLibrary.csproj 2> MSBuildSourceTargetName=GetTargetPath 2> Name=NetstandardLibrary 2> OriginalItemSpec=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> OriginalProjectReferenceItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OutputItemType= 2> Platform=AnyCPU 2> Project={0FE233C8-525C-49D7-A630-3A0B64676D8A} 2> ProjectReferenceOriginalItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> ReferenceOutputAssembly=true 2> ReferenceSourceTarget=ProjectReference 2> ResolvedFrom=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> SetConfiguration=Configuration=Debug 2> SetPlatform=Platform=AnyCPU 2> SetTargetFramework=TargetFramework=netstandard1.3;ProjectHasSingleTargetFramework=true 2> TargetPlatformIdentifier=Windows 2> TargetPlatformMoniker=Windows,Version=7.0 2> Targets= 2> UndefineProperties=;TargetFramework;ProjectHasSingleTargetFramework 2> Version=1.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> Implicit=true 2> OriginalItemSpec=System.Core 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Data.DataSetExtensions 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Data 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Net.Http 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Xml 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll 2> CopyLocal=false 2> FrameworkFile=true 2> FusionName=System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2> ImageRuntime=v4.0.30319 2> OriginalItemSpec=System.Xml.Linq 2> Redist=Microsoft-Windows-CLRCoreComp.4.6.1 2> ReferenceSourceTarget=ResolveAssemblyReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> Version=4.0.0.0 (TaskId:73) 2> Output Item(s): 2> ReferenceDependencyPaths= 2> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll 2> BuildReference=true 2> Configuration=Debug 2> CopyLocal=false 2> FrameworkFile=true 2> FullConfiguration=Debug|AnyCPU 2> FusionName=System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 2> ImageRuntime=v4.0.30319 2> MSBuildSourceProjectFile=C:\temp\14565\NetstandardLibrary\NetstandardLibrary.csproj 2> MSBuildSourceTargetName=GetTargetPath 2> Name=NetstandardLibrary 2> OriginalItemSpec=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> OriginalProjectReferenceItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OutputItemType= 2> Platform=AnyCPU 2> Project={0FE233C8-525C-49D7-A630-3A0B64676D8A} 2> ReferenceOutputAssembly=true 2> ReferenceSourceTarget=ProjectReference 2> ResolvedFrom={TargetFrameworkDirectory} 2> SetConfiguration=Configuration=Debug 2> SetPlatform=Platform=AnyCPU 2> SetTargetFramework=TargetFramework=netstandard1.3;ProjectHasSingleTargetFramework=true 2> TargetPlatformIdentifier=Windows 2> TargetPlatformMoniker=Windows,Version=7.0 2> Targets= 2> UndefineProperties=;TargetFramework;ProjectHasSingleTargetFramework 2> Version=4.0.20.0 (TaskId:73) 2> Output Item(s): 2> _ReferenceRelatedPaths= 2> C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.pdb 2> BuildReference=true 2> Configuration=Debug 2> CopyLocal=true 2> FullConfiguration=Debug|AnyCPU 2> FusionName= 2> MSBuildSourceProjectFile=C:\temp\14565\NetstandardLibrary\NetstandardLibrary.csproj 2> MSBuildSourceTargetName=GetTargetPath 2> Name=NetstandardLibrary 2> OriginalItemSpec=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> OriginalProjectReferenceItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OutputItemType= 2> Platform=AnyCPU 2> Project={0FE233C8-525C-49D7-A630-3A0B64676D8A} 2> ReferenceOutputAssembly=true 2> ReferenceSourceTarget=ProjectReference 2> ResolvedFrom=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> SetConfiguration=Configuration=Debug 2> SetPlatform=Platform=AnyCPU 2> SetTargetFramework=TargetFramework=netstandard1.3;ProjectHasSingleTargetFramework=true 2> TargetPlatformIdentifier=Windows 2> TargetPlatformMoniker=Windows,Version=7.0 2> Targets= 2> UndefineProperties=;TargetFramework;ProjectHasSingleTargetFramework 2> Version=1.0.0.0 (TaskId:73) 2> Output Item(s): 2> ReferenceCopyLocalPaths= 2> C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> BuildReference=true 2> Configuration=Debug 2> CopyLocal=true 2> FullConfiguration=Debug|AnyCPU 2> FusionName=NetstandardLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 2> ImageRuntime=v4.0.30319 2> MSBuildSourceProjectFile=C:\temp\14565\NetstandardLibrary\NetstandardLibrary.csproj 2> MSBuildSourceTargetName=GetTargetPath 2> Name=NetstandardLibrary 2> OriginalItemSpec=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> OriginalProjectReferenceItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OutputItemType= 2> Platform=AnyCPU 2> Project={0FE233C8-525C-49D7-A630-3A0B64676D8A} 2> ProjectReferenceOriginalItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> ReferenceOutputAssembly=true 2> ReferenceSourceTarget=ProjectReference 2> ResolvedFrom=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> SetConfiguration=Configuration=Debug 2> SetPlatform=Platform=AnyCPU 2> SetTargetFramework=TargetFramework=netstandard1.3;ProjectHasSingleTargetFramework=true 2> TargetPlatformIdentifier=Windows 2> TargetPlatformMoniker=Windows,Version=7.0 2> Targets= 2> UndefineProperties=;TargetFramework;ProjectHasSingleTargetFramework 2> Version=1.0.0.0 2> C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.pdb 2> BuildReference=true 2> Configuration=Debug 2> CopyLocal=true 2> FullConfiguration=Debug|AnyCPU 2> FusionName= 2> MSBuildSourceProjectFile=C:\temp\14565\NetstandardLibrary\NetstandardLibrary.csproj 2> MSBuildSourceTargetName=GetTargetPath 2> Name=NetstandardLibrary 2> OriginalItemSpec=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> OriginalProjectReferenceItemSpec=..\NetstandardLibrary\NetstandardLibrary.csproj 2> OutputItemType= 2> Platform=AnyCPU 2> Project={0FE233C8-525C-49D7-A630-3A0B64676D8A} 2> ReferenceOutputAssembly=true 2> ReferenceSourceTarget=ProjectReference 2> ResolvedFrom=C:\temp\14565\NetstandardLibrary\bin\Debug\netstandard1.3\NetstandardLibrary.dll 2> SetConfiguration=Configuration=Debug 2> SetPlatform=Platform=AnyCPU 2> SetTargetFramework=TargetFramework=netstandard1.3;ProjectHasSingleTargetFramework=true 2> TargetPlatformIdentifier=Windows 2> TargetPlatformMoniker=Windows,Version=7.0 2> Targets= 2> UndefineProperties=;TargetFramework;ProjectHasSingleTargetFramework 2> Version=1.0.0.0 (TaskId:73) 2> Output Item(s): FileWrites=obj\Debug\DesktopConsoleApp.csprojResolveAssemblyReference.cache (TaskId:73) 2> Output Property: DependsOnSystemRuntime=True (TaskId:73) 2>Done executing task "ResolveAssemblyReference". (TaskId:73) 2>Done building target "ResolveAssemblyReferences" in project "DesktopConsoleApp.csproj".: (TargetId:115)


I particularly found this part interesting that RAR saw the missing dependency but didn't bubble it up as an issue.

2>  Dependency "Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:73)
2>      Could not resolve this reference. Could not locate the assembly "Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. (TaskId:73)
dsplaisted commented 7 years ago

I think the issue here it's that the desktop project is not in PackageReference mode, so the reference don't flow.

This is a bad experience, we've had several other issues filled for this.

clairernovotny commented 7 years ago

@dsplaisted Not sure about that, I saw it in a PackageRef project here: https://github.com/onovotny/microsoft-authentication-library-for-dotnet/blob/b437210265d4c5fa33729c0580b5ce1c2c4c54e6/samples/DesktopTestApp/DesktopTestApp.csproj

https://github.com/dotnet/corefx/issues/14565#issuecomment-280880858

tjrobinson commented 7 years ago

See also: http://stackoverflow.com/questions/42312165/could-not-load-file-or-assembly-microsoft-win32-primitives-version-4-0-0-0

weshaggard commented 7 years ago

For anyone that might still be hitting this you can workaround it by explicitly making the .NET Framework project a ProjectReference based project by setting the following property in the project:

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

There is also a good change you will need auto-bindingredirects as well so make sure that is set in your project:

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
mauricio-bv commented 7 years ago

weshaggard, can you elaborate on the workaround? Where should I put the text below (which file)? In which project, the one targeting the .NET Standard or the one referencing the .Net Standard project (the .Net Framework project)?

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

weshaggard commented 7 years ago

In the .NET Framework project that is consuming the .NET Standard library. Note that if you have a packages.config file with nuget packages installed you will need to reinstall them as that property opts you into the PackageReference model instead of the packages.config model (see https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files for some more information).

jrr commented 7 years ago

@weshaggard - does PackageReference just happen to work with .NET Framework projects? The doc you linked suggests it's not supported:

At present, package references are supported in Visual Studio 2017 only, for .NET Core projects, .NET Standard projects, and UWP projects targeting Windows 10 Build 15063 (Creators Update).

jnm2 commented 7 years ago

I've been using <PackageReference> in .NET Framework new-style csproj since March and in Windows Forms old-style csproj since April. Definitely agree that the documentation needs to be improved.

danmoseley commented 7 years ago

cc @AlexGhiondea fyi.

remcolam commented 7 years ago

My .net framework 4.7 project already has the package references in the project file. I also tried adding the <RestoreProjectStyle>PackageReference</RestoreProjectStyle> and <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> But I'm still running into the FileNotFound exception as soon as I access code from the .net standards class library. I'm missing the references the class library depends on.

remcolam commented 7 years ago

BTW, what I'm noticing is that the exception I'm getting of for System.Data.Common version 4.1.0.0. If I look at the .net standard library, it uses the MySqlConnector nuget package, which has a dependency on System.Data.Common version 4.3.0.0. I can not find anything that wants to use version 4.1.0.0

If I use nuget to add this package to the .net framework app, then this is fixed, but it throws it for another dependency in the ,net standard class library.

danmoseley commented 7 years ago

@weshaggard can you help with the latest info above?

remcolam commented 7 years ago

I'm still having this issue with VS15.3 and netstandard 2.0 I've also reported this to the visual studio team now: System.IO.FileNotFoundException when referencing netstandard library project in classic project

You could try upvoting it there...

danmoseley commented 7 years ago

@weshaggard

weshaggard commented 7 years ago

@remcolam I pulled down your same solution from your reported issue and I did repro the issue but I was able to fix it by adding <RestoreProjectStyle>PackageReference</RestoreProjectStyle> in the ClassicConsole csproj. After adding that the dependencies correctly flowed from the NetStandard20Lib ProjectReference. Can you please try that to ensure it works for you?

remcolam commented 7 years ago

@weshaggard I was under the impression that was needed when switching from packages.config to project references, and I created these projects from the beginning with project references...

But I will try it and let you know.

It still seems to me visual studio should be making sure the dependencies flow through correctly, so I'll keep the issue open at visual studio community... 😉

weshaggard commented 7 years ago

@weshaggard I was under the impression that was needed when switching from packages.config to project references, and I created these projects from the beginning with project references...

Yes that us what it does but the package dependencies don't currently flow correctly in the packages.config world only in the new ProjectReference world.

It still seems to me visual studio should be making sure the dependencies flow through correctly, so I'll keep the issue open at visual studio community

I completely agree this is an issue that should be address which is why I opened this issue to track it as well. I'm only a consumer of these tools and so I would also like this fixed and what I suggested here is merely a workaround.

remcolam commented 7 years ago

Adding `

PackageReference

` to the project file for the classic project made it indeed work. Still strange , because this was already the format for the project... Oh well... Thanks for the help

babelshift commented 7 years ago

Why is this workaround necessary? Why is the behavior not defaulted to copying needed dependencies to the build directory? Under what scenario would I rather NOT have them copied? FYI this is still occurring in Visual Studio 2017 and .NET Standard 2.0.

davidfowl commented 7 years ago

@babelshift SDK projects don't copy dependencies to the output directory because the output can be different depending on what the TFM of the consuming project is. Consider the following:

A (project) (net461) B (project) (netstandard 2.0) Newtonsoft.Json (package) (net45, ns1.1)

A -> B -> Newtonsoft.Json

For this dependency graph, the version of Newtonsoft.Json copied to A's output folder is net45, the version copied into the output of B is ns1.1

babelshift commented 7 years ago

@davidfowl So what's the long term solution here? Using the PackageReference solution? Googling about this problem reveals a lot of confusion around this behavior, and the documentation could be more clear (unless I'm missing some important docs).

Please help me understand a bit more.

Console App (.NET 4.6.1) -> Class Library 1 (.NET 4.6.1) -> Class Library 2 (.NET Standard 2.0) -> NuGet Package (Newtonsoft.Json)

After build, the Console App's bin directory contains:

This will fail at runtime because Class Library 2.dll and Newtonsoft.Json.dll are non-existent.

The Visual Studio tooling seems to offer no assistance to remedy this unless I'm missing something.

davidfowl commented 7 years ago

@davidfowl So what's the long term solution here? Using the PackageReference solution? Googling about this problem reveals a lot of confusion around this behavior, and the documentation could be more clear (unless I'm missing some important docs).

Yes, that's the long term solution.

This will fail at runtime because Class Library 2.dll and Newtonsoft.Json.dll are non-existent.

Is Console App (.NET 4.6.1) using package reference? If, not then this is a known issue. We should have blocked that reference but we don't and it ends up breaking at runtime.

dasjestyr commented 7 years ago

Is this just for package references? I was directed here from the same issue regarding project references. I have the netstandard2.0 project in the same solution and I'm trying to reference from .net framework console app and nothing resolves. I added in the package restore style but it doesn't seem to work for me. Repro from scratch here: https://github.com/dasjestyr/netstandard_ref_error

Using VS2017.3.3. <RestoreProjectStyle>PackageReference</RestoreProjectStyle> did not work for me. It seems that the solution will build, but intellisense is still bleeding everywhere.

esentio commented 7 years ago

I'm using VS2017 15.3.3 and .NET Core 2.0.0 SDK. My (simplified) solution consists of following projects:

Using <RestoreProjectStyle>PackageReference</RestoreProjectStyle> fixed the problem in B. But when I applied it to C, suddenly all tests disappeared from Test Explorer window. To fix this issue, I had to upgrade test adapters and test framework via nuget as described here (in case somebody has the same problem).

Is this intended behavior of package reference or a bug?

dasjestyr commented 7 years ago

Disregard my comment with the repro link. I think it was resharper... sigh. I updated resharper and things started working.

GeeF commented 7 years ago

Dealing with a similar issue here. I have a simple .net standard 1.4 library that is tested using nunit3. Running on 4.6.1 I get this when running tests that use features from the library dealing with files:

System.IO.FileNotFoundException:
Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

The actual Version of System.IO.FileSystem I use is 4.3.0. I tried various workarounds from a few github issues but none of them seem to work. The only thing I found to work was to switch the library to .net standard 2.0.

dasjestyr commented 7 years ago

Have you tried adding a net461 target to the standard library? That fixed it for me.

jnm2 commented 7 years ago

The ideal scenario is that the class library is netstandard. and the test project targets net***;netcoreapp*.* or something like that. If you make the class library target both netstandard1.4 and net461, you won't be truly testing the netstandard1.4 dll because the test project will ignore it and pick up the net461 dll.

Pythonic-Rainbow commented 6 years ago

Still got the problem in VS2017 15.5 , .NET Framework 4.6.1 and Core 2.0 Standard 1.4 Yet solved by `

netstandard1.4
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

`

ryantromp commented 6 years ago

This works for project references for the project in the same solution. If I try to add a reference to an external project .dll from a project in another solution, that project's dependencies don't get copied into the output folder of the referring project.

michael-hawker commented 6 years ago

I think I'm seeing the same thing with a JavaScript UWP app, as the default VS template uses package.json for those projects.

Referencing a .NET Standard 1.4 component using ProjectReference through a Windows Runtime Component.

dasjestyr commented 6 years ago

@jnm2 I believe what you want to do is have the test project for a netstandard library actually target only netcoreapp. Then it will only pick up the netstandard version of the class library. I don't really see the point of having the test project target both net*** and netcoreapp. So basically reverse of what you're saying.

jnm2 commented 6 years ago

There is an argument to be made for testing a netstandard1.4 class library against net47;netcoreapp1.1;netcoreapp2.0 since the behaviors are different. But that's very difficult to do if the class library also targets net or netcoreapp, with current tooling. There are discussions other places about making this easier by allowing tests to target netstandard1.4 and configuring the test runner to execute the same test dll against multiple runtimes and versions.

My point is only that you should not target the class library as netstandard1.4;net461 unless your test project is netcoreapp.;net461 or else you'll be shipping an untested unique dll and that's a very bad thing to do.

godrose commented 6 years ago

@weshaggard This solution didn't work for me. I've added the two configuration lines in the .NET Framework project and rebuilt the whole solution. Still the .NET Standard package upon which the .NET Standard project depends isn't flown to the .NET Framework project's output folder

weshaggard commented 6 years ago

@godrose any chance you could post a simple repo solution somewhere? I do expect you are hitting the limitations outlined in this issue but I can hopefully help you find the right workaround.

godrose commented 6 years ago

I have an actual not-so-simple repro solution you can clone.

  1. Clone the https://github.com/LogoFX/Samples.Specifications
  2. Select the DebugWithFake build configuration
  3. Rebuild the solution
  4. Start it. Supply the "Admin" and "pass" as username and password.
  5. You should arrive at the main screen and see the grid with data.

How to reproduce the issue:

  1. Clean the ../bin/DebugWithFake folder's contents.
  2. Unload the Client.Launcher project
  3. Add the two items to the .csproj
  4. Reload the project
  5. Reinstall the packages (all but AutoMapper)
  6. Rebuild the solution
  7. Start it. Supply the "Admin" and "pass" as username and password.
  8. You should see the error Object reference is not set to an instance of an object
  9. Examine the folder. AutoMapper is not there

If these repo steps are too much I'll try to add a lighter repo tomorrow.

weshaggard commented 6 years ago

@godrose interestingly enough I got just the opposite results from you. With the simple clone at commit https://github.com/LogoFX/Samples.Specifications/commit/437cf1069b163c55abfd8867c2c56ee878405433 I get the "object reference is not set to an instance of an object" error. However if I go back one commit to https://github.com/LogoFX/Samples.Specifications/commit/8603d82b723debb0efc5fe22d740d6f3d2958105 and do a full clean (i.e. close VS and run git clean -xdf) then I can successfully login and see the grid of data. Can you please make sure you are cleaning, not only the bin folder but the obj folders as well, ideally a full git clean -xdf.

While looking around in the solution I noticed you have a lot of other projects which use packages.config files. It is generally not advised to mix and match solutions with some projects using packages.config and other projects using ProjectReference. The two models don't play well together as the packages.config projects do not correctly flow dependencies from referenced projects/packages.

godrose commented 6 years ago

Thanks. I will check this. I'm just trying out this approach to see if it fixes the issue

On 21 Feb 2018 20:09, "Wes Haggard" notifications@github.com wrote:

@godrose https://github.com/godrose interestingly enough I got just the opposite results from you. With the simple clone at commit LogoFX/Samples.Specifications@437cf10 https://github.com/LogoFX/Samples.Specifications/commit/437cf1069b163c55abfd8867c2c56ee878405433 I get the "object reference is not set to an instance of an object" error. However if I go back one commit to LogoFX/Samples.Specifications@8603d82 https://github.com/LogoFX/Samples.Specifications/commit/8603d82b723debb0efc5fe22d740d6f3d2958105 and do a full clean (i.e. close VS and run git clean -xdf) then I can successfully login and see the grid of data. Can you please make sure you are cleaning, not only the bin folder but the obj folders as well, ideally a full git clean -xdf.

While looking around in the solution I noticed you have a lot of other projects which use packages.config files. It is generally not advised to mix and match solutions with some projects using packages.config and other projects using ProjectReference. The two models don't play well together as the packages.config projects do not correctly flow dependencies from referenced projects/packages.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dotnet/sdk/issues/901#issuecomment-367417669, or mute the thread https://github.com/notifications/unsubscribe-auth/AHbkIxE1fewGpp2tiotemxgssSsIFU9cks5tXFvjgaJpZM4MI9nG .

godrose commented 6 years ago

@weshaggard Interestingly enough I managed to login successfully and see the grid after a full clean. I will convert the whole solution to this approach and see whether it works in all scenarios. Thanks a lot!

mcorsello commented 6 years ago

Not a question, but an observation and approach we're depending upon....

We are also experiencing some issues and have a concern about addressing the reverse transitive dependency issue for reflection loaded IoC patterns....

exe -> A <- B -> C exe is never aware of the existence of B or C A reflection loads B which has compile time dependency on C (say Npgsql.dll) Recompiling the exe is NOT an option (different vendors and runtime injection of capabilities)

Also, there are multiple items loaded this way exe -> A <- B -> C(v1) ^--- D -> C(v2) As long as C(v2) is capable of supporting C(v1) surface area, we realize C(v2) at runtime for both B and D, which are reflection loaded by A again with no knowledge from the exe.

this has been working fine in purely net 4.6.1, but now with netstandard, we have been having different issues on production machines and dev machines. We can work around the issue on dev machines (Win 10) by adding version bindings in the .exe.config (not ideal) on the dev machines, but have "odd" issues we still haven't resolved on prod machines (not Win 10).

greg84 commented 6 years ago

I have experienced this same issue, but the workaround didn't seem to resolve the problem in my case. Here are some steps to reproduce a simple version of what I'm seeing:

  1. Create a new solution. Add a new NetStandard class library project to it.
  2. Add a new ASP.NET Web Application project to the same solution - select "Web API" as the template.
  3. Add the class library project to the web application project as a project reference.
  4. Add the "System.Data.SqlClient" Nuget package to the class library project..
  5. Add this class to the class library project:
    
    using System.Data.SqlClient;

namespace ClassLibrary1 { public class Class1 { public Class1() { var connection = new SqlConnection(""); } } }

6. At the end of the Global.asax file in the web application project root, add the following line:

var c = new ClassLibrary1.Class1();


7. Run the web application project. It crashes on startup at the line above with the following error:

> System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

Not sure if it's something specifically to do with how web application projects resolve dependencies, but adding the `RestoreProjectStyle` and `AutoGenerateBindingRedirects` to the project file didn't fix the issue.

The only way I could work around the problem was to install all the dependencies in both projects.
dsteinweg commented 6 years ago

I encountered this problem today, and it happened to be with the exact same System.Data.SqlClient.dll that @greg84 ran into problems with.

I have uploaded a simple repro like @greg84 described here: https://github.com/dsteinweg/dotnet-sdk-issue-901

dsplaisted commented 6 years ago

There are two ways to fix this:

veremenko-y commented 6 years ago

Can we just don't break .NET Framework projects introducing half done (like .NET Core) style features?

offgriddev commented 6 years ago

I've encountered this issue today when I deploy to my Azure App Service. We're running Full Framework 4.7 and one of our libraries is responsible for rendering Razor views to string for export. It leverages Microsoft.AspNetCore.Mvc.ViewFeatures. The code for this is pretty standard:

` public async Task RenderAsString(string viewName, object model) { var httpContext = new DefaultHttpContext { RequestServices = _serviceProvider }; var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());

        using (var sw = new StringWriter())
        {
            var viewResult = _razorViewEngine.FindView(actionContext, viewName, false);

            if (viewResult.View == null)
            {
                throw new ArgumentNullException($"{viewName} does not match any available view");
            }

            var viewDictionary = new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary())
            {
                Model = model
            };

            var viewContext = new ViewContext(
                actionContext,
                viewResult.View,
                viewDictionary,
                new TempDataDictionary(actionContext.HttpContext, _tempDataProvider),
                sw,
                new HtmlHelperOptions()
            );

            try
            {
                await viewResult.View.RenderAsync(viewContext);
            }
            catch (Exception e)
            {
                _logger.Error(e, "An error occurred while rendering HTML from Razor templates.");
                return String.Empty;
            }

            return sw.ToString();
        }
    }

It works perfectly fine locally, but when I deploy it to our app service, I get the following error whenawait viewResult.View.RenderAsync(viewContext)` is invoked:

System.InvalidOperationException: Cannot find reference assembly 'Microsoft.Win32.Primitives.dll' file for package Microsoft.Win32.Primitives.Reference at Microsoft.Extensions.DependencyModel.Resolution.ReferenceAssemblyPathResolver.TryResolveAssemblyPaths(CompilationLibrary library, List1 assemblies) at Microsoft.Extensions.DependencyModel.Resolution.CompositeCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List1 assemblies) at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List1 assemblies) at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths() at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.<>c.b8_0(CompilationLibrary library) at System.Linq.Enumerable.d172.MoveNext() at Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature(IEnumerable1 parts, MetadataReferenceFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature) at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.GetCompilationReferences() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func1 valueFactory) at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.get_CompilationReferences() at Microsoft.AspNetCore.Mvc.Razor.Internal.LazyMetadataReferenceFeature.get_References() at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors() at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document) at Microsoft.AspNetCore.Razor.Language.DefaultRazorProjectEngine.ProcessCore(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Razor.Language.RazorProjectEngine.Process(RazorProjectItem projectItem) at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath) at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.OnCacheMiss(String normalizedPath) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet1 expirationTokens, String relativePath, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.d20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.d5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.d12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at AspNetCore.Views_Export_SubmissionPdf.<>c__DisplayClass9_0.<b1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.d30.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at AspNetCore.Views_Export_SubmissionPdf.d9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.d16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.d15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.d14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Presence.Core.Http.ViewEngine.RenderView.d5.MoveNext() `

WeihanLi commented 5 years ago

that's really a bad experience

peeveen commented 1 year ago

The workaround isn't working for me. The scenario might be slightly different:

If I run msbuild with -verbosity:detailed, I can see:

Could not resolve this reference. Could not locate the assembly "...blah...". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

... but this does not appear as a warning/error in the Visual Studio build output.

My NETFramework project has the suggested properties in the csproj file:

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

I can solve the problem by adding a direct reference to the missing assembly in either my NETStandard class library or my NETFramework project, but it seems like a possible bug somewhere.