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

Should get a single actionable error when the target framework is wrong #1233

Closed
davkean opened this issue May 19, 2017 · 3 comments
Closed
Assignees
Milestone

Comments

@davkean
Copy link
Member

davkean commented May 19, 2017

  1. File -> New Console App
  2. Right-click on project and choose Edit -> ConsoleApp.csproj
  3. Change target framework to "FooBar"
  4. Save project

Expected: A single actionable error
Actual:

First, during the design-time build the following error shows up:

Error	MSB3645	.NET Framework v3.5 Service Pack 1 was not found. In order to target ".NETFramework,Version=v0.0", .NET Framework v3.5 Service Pack 1 or later must be installed.	ConsoleApp4	C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets	1111	
Error	MSB3644	The reference assemblies for framework ".NETFramework,Version=v0.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.	ConsoleApp4	C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets	1111	

Then when you do a full "build", you get none of which tell me that I'm typed my target framework incorrectly:

Error		Cannot infer TargetFrameworkIdentifier and/or TargetFrameworkVersion from TargetFramework='FooBar'. They must be specified explicitly.	ConsoleApp4	C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets	84	
Error	MSB3645	.NET Framework v3.5 Service Pack 1 was not found. In order to target ".NETFramework,Version=v0.0", .NET Framework v3.5 Service Pack 1 or later must be installed.	ConsoleApp4	C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets	1111	
Error	MSB3644	The reference assemblies for framework ".NETFramework,Version=v0.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.	ConsoleApp4	C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets	1111	
Error		Assets file 'C:\Users\davkean\Source\Repos\ConsoleApp4\ConsoleApp4\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v0.0'. Ensure you have restored this project for TargetFramework='net' and RuntimeIdentifier=''.	ConsoleApp4	C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets	129	

We should turn this into a single actionable error, that should block all other targets from running, and it must run during design-time builds so that it shows up immediately, not when you build.

@nguerrera
Copy link
Contributor

@dsplaisted this is related to the other cases where we want to exit with a clean error.

@nguerrera nguerrera added this to the 2.0.0 milestone May 22, 2017
@dsplaisted
Copy link
Member

This is related to #798 and dotnet/msbuild#2116

@dsplaisted dsplaisted self-assigned this May 26, 2017
@dsplaisted
Copy link
Member

This should be fixed by #1274 and dotnet/msbuild#2133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants