Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
NickAcPT opened this issue Mar 31, 2020 · 22 comments
Closed

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

NickAcPT opened this issue Mar 31, 2020 · 22 comments
Labels
Milestone

Comments

@NickAcPT
Copy link

NickAcPT commented Mar 31, 2020

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

  • DllExport -version: .NET DllExport 1.7.0.60761+0a002a7
  • Used Visual Studio / MSBuild : Version 16.6.0 Preview 1.0

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>
@NickAcPT NickAcPT added the bug label Mar 31, 2020
@3F
Copy link
Owner

3F commented Mar 31, 2020

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
Copy link
Author

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
Copy link
Author

I guess I could try reinstalling both Buildtools?

@3F
Copy link
Owner

3F commented Mar 31, 2020

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: #139 (comment) Thus, please show also result for this:

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

@NickAcPT
Copy link
Author

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

</details>

@NickAcPT NickAcPT reopened this Mar 31, 2020
@NickAcPT
Copy link
Author

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

@3F
Copy link
Owner

3F commented Mar 31, 2020

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
Copy link
Author

NickAcPT commented Mar 31, 2020

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
Copy link
Owner

3F commented Mar 31, 2020

what about this:

hMSBuild -only-path -vsw-as "-products * -latest -prerelease" -vsw-version 2.7.1 -no-cache

@NickAcPT
Copy link
Author

Only this:

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

@3F
Copy link
Owner

3F commented Mar 31, 2020

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
Copy link
Author

NickAcPT commented Mar 31, 2020

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
Copy link
Owner

3F commented Apr 1, 2020

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 #143 (comment)

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
Copy link
Author

NickAcPT commented Apr 1, 2020

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
Copy link
Author

NickAcPT commented Apr 1, 2020

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
Copy link
Owner

3F commented Apr 1, 2020

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
Copy link
Author

NickAcPT commented Apr 1, 2020

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

@3F
Copy link
Owner

3F commented Apr 1, 2020

@NickAcPT
Copy link
Author

NickAcPT commented Apr 1, 2020

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
Copy link
Owner

3F commented Apr 1, 2020

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
Copy link
Author

NickAcPT commented Apr 1, 2020

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 3F closed this as completed in 848e19b Apr 2, 2020
@3F
Copy link
Owner

3F commented Apr 2, 2020

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

@3F 3F added this to the 1.7.1 milestone Apr 15, 2020
3F added a commit that referenced this issue May 7, 2020
* NEW: Pre-Processing feature. PR #146.
       Related issue #40

       Official ILMerge support;
       https://github.com/dotnet/ILMerge

       Quick integration with Conari for most easy access to unmanaged features;
       https://github.com/3F/Conari

       +Other related tools and assembly manipulations.
       Manual configuring: #40 (comment)

* NEW: Post-Processing. PR #148.
       Continues direction of Pre-Processing feature. PR #146
       Related issue #144

       Explanation and details:
       https://ko-fi.com/Blog/Post/ILMerge---Conari---Debug-information---DllExport-=-O5O61MV8A

       1.7.1 Provides only basic GUI support for predefined options. Thus,

        *! Some Post-Proc features are not yet available in GUI.
        But you can already configure it with msbuild:
        ```
        <Target Name="DllExportPostProc">

            <!-- After activation, you can access the following properties and items:

            $(DllExport)     - version
            $(DllExportSln)  - full path to .sln which controls current project
            $(DllExportPrj)  - full path to current project where processed .NET DllExport

            @(DllExportDirX64)    - $(TargetDir)x64\*.*
            @(DllExportDirX86)    - $(TargetDir)x86\*.*
            @(DllExportDirBefore) - $(TargetDir)Before\*.*
            @(DllExportDirAfter)  - $(TargetDir)After\*.*

            @(DllExportDependents + populated property name)
               - each populated properties from DllExportProcEnv,
                  e.g. DllExportDependentsTargetDir

            @(DllExportDependencies + populated property name)
              - each populated properties from DllExportProcEnv,
                  e.g. DllExportDependenciesTargetDir

            @(DllExportSeqDependents + populated property name)
               - each populated properties from DllExportProcEnv,
                  e.g. DllExportSeqDependentsTargetDir

            -->

        </Target>
        ```
        #148 (comment)

* NEW: Optional copying of intermediate files + x86+x64 directories into output
           for projects that dependent on projects where used DllExport. Issue #144.

           Including sequential referencing through other projects:
           #148 (comment)

* FIXED: Fixed #140 ... failed to create safe SSL/TLS context.

* FIXED: Pack of fixes for .net.dllexport.targets. PR #147.

        * Fixed "Cannot modify an evaluated object originating in an imported file".
        * Fixed possible duplication in .net.dllexport.targets when configuring.
        * Adds removing TargetsFile if not used.
        * Fixed possible loss of settings in .targets when configuring.

* FIXED: Fixed #143 'Microsoft.NET.Sdk' specified could not be found.

* FIXED: A multiple empty `<PropertyGroup />` in project files during new configuration.

* CHANGED: Wizard. Dropped support for ssl3 + tls1.0 + tls1.1

* CHANGED: Wizard. Simplified notification for stable versions.

* CHANGED: Manager. Access to hMSBuild tool (packed) via `-hMSBuild` key.
                    https://github.com/3F/hMSBuild
                    Since it uses packed version (while GetNuTool is integrated inside),
                    you need use -dxp-version to control specific version.

* CHANGED: Updated Cecil 0.11.2
           https://github.com/jbevain/cecil/releases/tag/0.11.2

* CHANGED: Updated MvsSln 2.5.2
           https://github.com/3F/MvsSln/releases/tag/2.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants