3F / DllExport

.NET DllExport with .NET Core support (aka 3F/DllExport aka DllExport.bat)
MIT License
938 stars 131 forks source link

The SDK 'Microsoft.NET.Sdk' specified could not be found. #143

Closed NickAcPT closed 4 years ago

NickAcPT commented 4 years ago

Steps to reproduce: I created a .Net Core 3.1 class library project.

Information from Data tab or log data:

SignAssembly: 
Identifier: 4ABE2AFA-5379-4FD4-855F-EE48A89B797C
Instance: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\MSBuild.exe
Project path: 
Action: Configure
PlatformTarget: 
TargetFramework: 
TargetFrameworks: 
TargetFrameworkVersion: 
RootNamespace: 
AssemblyName: 
MgrArgs: 
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy: 
StoragePath: .net.dllexport.targets
ddNS: 
ddNS max buffer: 500
UseCecil: True
intermediateFiles: False
timeout: 30000
RootPath: C:\Users\NickAc\Source\Repos\WinTabby\
PkgPath: C:\Users\NickAc\Source\Repos\WinTabby\packages\\DllExport.1.7.0\
SlnFile: 
SlnDir: C:\Users\NickAc\Source\Repos\WinTabby\.\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgGuiLevel: -1
LockIfError: The SDK 'Microsoft.NET.Sdk' specified could not be found.  C:\Users\NickAc\Source\Repos\WinTabby\WinTabby.Hook\WinTabby.Hook.csproj

Demo Project files / Samples / etc.:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
</Project>
3F commented 4 years ago

Thanks for the report,

Do you only have a preview release from 16.x ? and seems like stable in 15.x Can you show result for the command:

hMSBuild -only-path -vsw-as "-products * -latest -prerelease"

NickAcPT commented 4 years ago

Pardon for the late reply!

Here's the output:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\MSBuild.exe

I've also had this problem (not sure if related):

Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found. Manifest file path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers\Microsoft.Build.NuGetSdkResolver\Microsoft.Build.NuGetSdkResolver.xml'. SDK resolver path: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll  C:\Users\NickAc\Source\Repos\WinTabby\WinTabby\WinTabby.csproj

I've changed the xml file to the following as a workaround:

<SdkResolver>
  <Path>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll</Path>
</SdkResolver>
NickAcPT commented 4 years ago

I guess I could try reinstalling both Buildtools?

3F commented 4 years ago

Pardon for the late reply!

Don't worry, this was actually fast :)

Since -prerelease indicates the same result, could you please also check this command:

hMSBuild -only-path -vsw-as "-products * -latest -prerelease -all"

I guess I could try reinstalling both Buildtools?

Hmm, it could be really similar to recent problem: https://github.com/3F/DllExport/issues/139#issuecomment-604426500 Thus, please show also result for this:

vswhere -requires Microsoft.Component.MSBuild -products * -prerelease -all
NickAcPT commented 4 years ago

Since -prerelease indicates the same result, could you please also check this command:

hMSBuild -only-path -vsw-as "-products * -latest -prerelease -all"

It only outputs the following:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe

Hmm, it could be really similar to recent problem: #139 (comment) Thus, please show also result for this:

vswhere -requires Microsoft.Component.MSBuild -products * -prerelease -all
Output ``` Visual Studio Locator version 2.7.1+180c706d56 [query version 2.6.32.15131] Copyright (C) Microsoft Corporation. All rights reserved. instanceId: 19ee2f3f installDate: 05/07/2019 18:57:53 installationName: VisualStudio/15.9.19+28307.1000 installationPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools installationVersion: 15.9.28307.1000 productId: Microsoft.VisualStudio.Product.BuildTools productPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\LaunchDevCmd.bat state: 4294967295 isComplete: 1 isLaunchable: 1 isPrerelease: 0 isRebootRequired: 0 displayName: Visual Studio Build Tools 2017 description: The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support. channelId: VisualStudio.15.Release channelUri: https://aka.ms/vs/15/release/channel enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service releaseNotes: https://go.microsoft.com/fwlink/?LinkId=660692#15.9.19 thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=660708 updateDate: 2020-02-10T03:00:40.4143947Z catalog_buildBranch: d15.9 catalog_buildVersion: 15.9.28307.1000 catalog_id: VisualStudio/15.9.19+28307.1000 catalog_localBuild: build-lab catalog_manifestName: VisualStudio catalog_manifestType: installer catalog_productDisplayVersion: 15.9.19 catalog_productLine: Dev15 catalog_productLineVersion: 2017 catalog_productMilestone: RTW catalog_productMilestoneIsPreRelease: False catalog_productName: Visual Studio catalog_productPatchVersion: 19 catalog_productPreReleaseMilestoneSuffix: 1.0 catalog_productRelease: RTW catalog_productSemanticVersion: 15.9.19+28307.1000 catalog_requiredEngineVersion: 1.18.1049.33485 properties_campaignId: properties_channelManifestId: VisualStudio.15.Release/15.9.19+28307.1000 properties_nickname: properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe instanceId: 3859cb7f installDate: 23/04/2019 18:57:31 installationName: VisualStudioPreview/16.6.0-pre.1.0+29911.98 installationPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview installationVersion: 16.6.29911.98 productId: Microsoft.VisualStudio.Product.Community productPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\devenv.exe state: 4294967295 isComplete: 1 isLaunchable: 1 isPrerelease: 1 isRebootRequired: 0 displayName: Visual Studio Community 2019 description: Powerful IDE, free for students, open-source contributors, and individuals channelId: VisualStudio.16.Preview channelUri: https://aka.ms/vs/16/pre/channel enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service releaseNotes: https://go.microsoft.com/fwlink/?LinkId=660894#16.6.0-pre.1.0 thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=660909 updateDate: 2020-03-17T18:37:02.3065311Z catalog_buildBranch: d16.6 catalog_buildVersion: 16.6.29911.98 catalog_id: VisualStudioPreview/16.6.0-pre.1.0+29911.98 catalog_localBuild: build-lab catalog_manifestName: VisualStudioPreview catalog_manifestType: installer catalog_productDisplayVersion: 16.6.0 Preview 1.0 catalog_productLine: Dev16 catalog_productLineVersion: 2019 catalog_productMilestone: Preview catalog_productMilestoneIsPreRelease: True catalog_productName: Visual Studio catalog_productPatchVersion: 0 catalog_productPreReleaseMilestoneSuffix: 1.0 catalog_productSemanticVersion: 16.6.0-pre.1.0+29911.98 catalog_requiredEngineVersion: 2.6.32.15131 properties_campaignId: properties_canceled: 0 properties_channelManifestId: VisualStudio.16.Preview/16.6.0-pre.1.0+29911.98 properties_nickname: properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe ```
NickAcPT commented 4 years ago

Didn't mean to close it. Is my installation somehow broken? I've had VS 2017 installed before.

3F commented 4 years ago

Is my installation somehow broken?

No, I'm seeing a two isComplete: 1 instances for your case. That's ok and nothing related to #139

Moreover, last result for hMSBuild is also ok.

Are you sure that hMSBuild -only-path -vsw-as "-products * -latest -prerelease" returns VS2017 ? :) strange result

What about this?

vswhere -requires Microsoft.Component.MSBuild -products * -latest -prerelease

and this

vswhere -requires Microsoft.Component.MSBuild -products * -latest -prerelease -all
NickAcPT commented 4 years ago

Are you sure that hMSBuild -only-path -vsw-as "-products * -latest -prerelease" returns VS2017 ? :) strange result

Yup. Don't know why it happens though.

vswhere -requires Microsoft.Component.MSBuild -products * -latest -prerelease

out1.txt

vswhere -requires Microsoft.Component.MSBuild -products * -latest -prerelease -all

out2.txt

3F commented 4 years ago

what about this:

hMSBuild -only-path -vsw-as "-products * -latest -prerelease" -vsw-version 2.7.1 -no-cache
NickAcPT commented 4 years ago

Only this:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe
3F commented 4 years ago

And please this:

hMSBuild -debug -only-path -vsw-as "-products * -latest -prerelease"
hMSBuild -debug -only-path -vsw-as "-products * -latest -prerelease" -vsw-version 2.8.4 -no-cache
NickAcPT commented 4 years ago

Sorry again for the late reply.. Closed the tab accidentally.

hMSBuild -debug -only-path -vsw-as "-products * -latest -prerelease"
Output ``` [ 0:55:26.58 ] trying via vswhere... [ 0:55:26.58 ] bat/exe: D:\Downloads\vswhere [ 0:55:26.60 ] bat/exe: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere [ 0:55:26.60 ] vswbin: "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" [ 0:55:26.61 ] assign command: -products * -latest -prerelease [ 0:55:26.61 ] attempts with filter: [ 0:55:26.74 ] vspath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview [ 0:55:26.74 ] vsver: 16.6.29911.98 [ 0:55:26.75 ] found path via vswhere: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin [ 0:55:26.75 ] found /amd64 C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe ```
hMSBuild -debug -only-path -vsw-as "-products * -latest -prerelease" -vsw-version 2.8.4 -no-cache
Output ``` [ 0:56:25.21 ] selected vswhere version: 2.8.4 [ 0:56:25.22 ] trying via vswhere... [ 0:56:25.23 ] tvswhere: C:\Users\NickAc\AppData\Local\Temp\hMSBuild_vswhere\_mta\1833130727vswhere [ 0:56:25.23 ] GetNuTool call: /p:ngpackages="vswhere/2.8.4:vswhere" /p:ngpath="C:\Users\NickAc\AppData\Local\Temp\hMSBuild_vswhere\_mta\1833130727vswhere" GetNuTool 1.8.0.7195+df76082 (c) 2015-2018,2020 Denis Kuzmin [ x-3F@outlook.com ] GitHub/3F Getting `vswhere/2.8.4` ... Extracting into "C:\Users\NickAc\AppData\Local\Temp\hMSBuild_vswhere\_mta\1833130727vswhere\vswhere" [ 0:56:27.69 ] bat/exe: C:\Users\NickAc\AppData\Local\Temp\hMSBuild_vswhere\_mta\1833130727vswhere\vswhere\tools\vswhere [ 0:56:27.69 ] vswbin: "C:\Users\NickAc\AppData\Local\Temp\hMSBuild_vswhere\_mta\1833130727vswhere\vswhere\tools\vswhere.exe" [ 0:56:27.70 ] assign command: -products * -latest -prerelease [ 0:56:27.70 ] attempts with filter: [ 0:56:27.80 ] vspath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview [ 0:56:27.80 ] vsver: 16.6.29911.98 [ 0:56:27.81 ] found path via vswhere: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin [ 0:56:27.81 ] found /amd64 [ 0:56:27.82 ] reset vswhere C:\Users\NickAc\AppData\Local\Temp\hMSBuild_vswhere\_mta\1833130727vswhere C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe ```
3F commented 4 years ago

The results confuses me a bit. Thank you for the new details!

Before your last reply I thought about bug or changed behavior of the vswhere tool between local and remote versions.

But the default command for hmsbuild points exactly on local use:

[ 0:55:26.60 ] vswbin: "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"

Where used 2.7.1 due to result from https://github.com/3F/DllExport/issues/143#issuecomment-606931074

But other forcibly use of 2.8.4 is also detects 16.6.29911.98

Can you please try again for this first command:

hMSBuild -only-path -vsw-as "-products * -latest -prerelease"

If still, then I will look later problems as part of the hMSBuild project.

For DllExport project more like we need add -prerelease key anyway. For the cases like yours it could be a good solution before replacing msbuild evaluator in future.

NickAcPT commented 4 years ago

Can you please try again for this first command:

hMSBuild -only-path -vsw-as "-products * -latest -prerelease"
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe

So, did I somehow break your project? Am a bit confused. Also, I've updated the 2017 Build Tools but forgot to add that to one of my previous replies. Sorry for not mentioning it.

NickAcPT commented 4 years ago

I've opened DllExport and on the data tab there's this:

Data ``` Installed: False Project type: Cs PkgVer: 1.7.0 Storage: ProjectFiles Compiler.Platform: Auto Compiler.ordinalsBase: 1 Compiler.rSysObj: False Compiler.ourILAsm: False Compiler.customILAsm: Compiler.genExpLib: False Compiler.peCheck: PeIl Compiler.patches: None SignAssembly: Identifier: B4A6A735-2150-4F7C-921C-0AE0828EDC6B Instance: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\MSBuild.exe Project path: Action: Configure PlatformTarget: TargetFramework: TargetFrameworks: TargetFrameworkVersion: RootNamespace: AssemblyName: MgrArgs: MetaLib: tools\raw\lib\net20\DllExport.dll MetaCor: tools\raw\lib\netstd\DllExport.dll Proxy: StoragePath: .net.dllexport.targets ddNS: ddNS max buffer: 500 UseCecil: True intermediateFiles: False timeout: 30000 RootPath: C:\Users\NickAc\Source\Repos\WinTabby\ PkgPath: C:\Users\NickAc\Source\Repos\WinTabby\packages\\DllExport.1.7.0\ SlnFile: SlnDir: C:\Users\NickAc\Source\Repos\WinTabby\.\ DxpTarget: tools\net.r_eg.DllExport.targets MsgGuiLevel: -1 LockIfError: The SDK 'Microsoft.NET.Sdk' specified could not be found. C:\Users\NickAc\Source\Repos\WinTabby\WinTabby.Hook\WinTabby.Hook.csproj ```

If needed, I could try using a normal .NET Framework project for this.

3F commented 4 years ago

So, did I somehow break your project?

No, I meant the bug that should be considered as part of other project. DllExport includes hMSBuild but this are different projects of course

C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe

This is other result from your first reply:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\MSBuild.exe

And it's more like this is what we need. Later I'll push solution with -prerelease key.

If needed, I could try using a normal .NET Framework project for this.

No, it does not related to netfx.

NickAcPT commented 4 years ago

Oh I see. Thanks a lot for your time! Is there anything else needed from my side?

3F commented 4 years ago

@NickAcPT Yes, please confirm solution 003360a4 compiled DllExport.bat: https://ci.appveyor.com/api/buildjobs/1992r7x51dcg5hx8/artifacts/bin%2FRelease%2FDllExport.bat

NickAcPT commented 4 years ago

Pardon the delay, but I can confirm that it just works. Thanks a lot. Is there anything else needed for this issue or can it be closed?

3F commented 4 years ago

Pardon the delay, but I can confirm that it just works. Thanks a lot.

Good!

Is there anything else needed for this issue or can it be closed?

I don't think so :) You can close it if your problem is fixed now. Or it will be closed anyway after merging into master branch.

@NickAcPT I don't have ETA yet for the new public release. I think we'll wait a bit to review the problem #141 and related. But you can use this CI build as a temporary solution in your case. Please don't use it in production before official release.

NickAcPT commented 4 years ago

I don't think so :) You can close it if your problem is fixed now. Or it will be closed anyway after merging into master branch.

I'll leave this opened until the PR gets merged so that it's easier to know what's been fixed and what wasn't.

But you can use this CI build as a temporary solution in your case. Please don't use it in production before official release.

Will do! Thanks a lot for helping 👍

3F commented 4 years ago

FYI: corrected processing of -msb key after last fixes for this problem. Use 848e19b instead.