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

Unable to build old projects with VS2019 - MSB4019 #4786

Closed
weitzhandler opened this issue Oct 6, 2019 · 7 comments
Closed

Unable to build old projects with VS2019 - MSB4019 #4786

weitzhandler opened this issue Oct 6, 2019 · 7 comments
Labels

Comments

@weitzhandler
Copy link

Steps to reproduce

Hello

I'm trying to get the odata.net repo to build on VS2019.
I've updated the build.ps1 file (weitzhandler/odata.net@3dbccef) with the appropriate paths and all, but I'm still getting the following error x5:

C:\Users\HP\source\repos\odata.net\tools\CustomMSBuild\Portable.targets(17,3): error MSB4019: The imported project
"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\MSBuild\Microsoft\Portable\v5.0\Microsoft.Portable.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
[C:\Users\HP\source\repos\odata.net\src\Microsoft.Spatial\Build.NetStandard\Microsoft.Spatial.NetStandard.csproj]

After checking, the Portable folder is completely missing.
I only have 2019 installed on my machine.

Is there anyway I can get this to run on a VS-only machine while still maintain project backwards compatibility (so that it can still build in older versions of VS)?

Expected behavior

File build.ps1 should execute properly

Actual behavior

Old build paths not found

Environment data

msbuild /version output:

16.2.37902.0

OS info:
Windows 10x64 (1903 - build 18362.356)
VS 2019 (16.2.x)

@jmarolf
Copy link
Contributor

jmarolf commented Oct 6, 2019

If you scroll all the way down below Snapshot Debugging on the VS 2019 release notes (or just search for PCL on the page). You will see:

Portable Class Library (PCL) project templates are no longer available, and project support will not be installed by default. New projects intended to target multiple platforms should use the .NET Standard project type. Customers who require PCL project support must install the component separately from the Individual Components tab in the Visual Studio installer.

Here is the item in the installer you will need to check for things to work

image

@weitzhandler
Copy link
Author

That solved the issue.
Thank you so much!

@devsoftx
Copy link

Hi
I got this error when I executed dotnet build, I just updated vs2019 with new .NET 5, however when I build with VS2019 works, but with CLI:

C:\Program Files\dotnet\sdk\5.0.100\Current\SolutionFile\ImportAfter\Microsoft.NET.Sdk.Solution.targets(14,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" is correct, and that the file exists on disk

same issue with msbuild XXX.sln

error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.

dotnet msbuild version:
MSBUILD : error MSB1001: Unknown switch.
Switch: --version

Thanks in advance

@stonstad
Copy link

Hi
I got this error when I executed dotnet build, I just updated vs2019 with new .NET 5, however when I build with VS2019 works, but with CLI:

C:\Program Files\dotnet\sdk\5.0.100\Current\SolutionFile\ImportAfter\Microsoft.NET.Sdk.Solution.targets(14,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" is correct, and that the file exists on disk

same issue with msbuild XXX.sln

error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.

dotnet msbuild version:
MSBUILD : error MSB1001: Unknown switch.
Switch: --version

Thanks in advance

I'm seeing the same behavior. w/ .NET Portable Library targeting pack already installed.

@marekdovjak
Copy link

Same issue here, .NET Portable Library targeting pack already installed. Anyone got solution?

@marekdovjak
Copy link

I migrated the old .net4.x project causing the issue to netstandard (or net5) and it works now

@ailn
Copy link

ailn commented Feb 25, 2021

Same issue:
C:\Program Files\dotnet\sdk\5.0.103\Current\SolutionFile\ImportAfter\Microsoft.NET.Sdk.Solution.targets(14,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.404\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.404\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" is correct, and that the file exists on disk.

Solution has libs which target netstandard2.0 and all executables target net5.0

@AR-May AR-May added the triaged label Feb 21, 2024
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

7 participants