MSB4011 warning when using net6.0-macos (inside Visual Studio only)
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
**Repro steps**
Provide the steps required to reproduce the problem:
1. Create a new .NET 6 `fsproj` class library via the stock template Visual Studio uses, then change the `TargetFramework` to `net6.0-macos` instead of `net6.0`.
2. Build the project.
The full repro is simply the default project with the mentioned `TargetFramework` change:
```xml
net6.0-macos
true
```
My `global.json` is
```json
{
"sdk": {
"version": "6.0.400"
}
}
```
**Expected behavior**
No build warnings occur.
**Actual behavior**
A warning is encountered:
> 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VisualStudio\v17.0\FSharp\Microsoft.FSharp.Targets(4,3): warning MSB4011: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools\Microsoft.FSharp.targets" cannot be imported again. It was already imported at "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools\Microsoft.FSharp.NetSdk.targets (46,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\Projects\Repro_MSB4011\Repro_MSB4011.fsproj]
**Known workarounds**
Building the project from the CLI via `dotnet build` does not give this warning.
**Related information**
Provide any related information (optional):
* Operating system: Windows 11
* .NET Runtime kind: .NET 6 (Core)
* Editing Tools: Visual Studio
Visual Studio Info
Microsoft Visual Studio Community 2022
Version 17.3.1
VisualStudio.17.Release/17.3.1+32811.315
Microsoft .NET Framework
Version 4.8.04161
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA871
Microsoft Visual C++ 2022
ASP.NET and Web Tools 17.3.375.53775
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.3.375.53775
Azure App Service Tools v3.0.0
C# Tools 4.3.0-3.22401.3+41ae77386c335929113f61d6f51f2663d2780443
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
CodeMaid 12.0
CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Edit Project 1.7.72
An open source Visual Studio extension to add the context menu for editing project/solution file.
Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
F# Formatting 1.0
F# source code formatting using Fantomas.
File Icons 2.7
Adds icons for files that are not recognized by Solution Explorer
Markdown Editor v2 2.0.127
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.3.20 (3f4cb00)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387
Provides languages services for ASP.NET Core Razor.
Rewrap Extension 1.0
Re-wraps comments and other text
SubwordNavigation 2.0.0
Provides subword navigation for Visual Studio.
TabPath Extension 1.3.0
Shows file paths in tab titles.
Trim Copy 2.4
Copies code block trimming leading white spaces while keeping indentation structure.
TypeScript Tools 17.0.10701.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.3.0-3.22401.3+41ae77386c335929113f61d6f51f2663d2780443
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Cross Platform Mobile Development (Android) 17.0.32708.82
Visual C++ for Cross Platform Mobile Development (Android)
Visual F# Tools 17.1.0-beta.22363.4+1b94f89d4d1f41f20f9be73c76f4b229d4e49078
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
Visual Studio Spell Check Everywhere VSSpellCheckEverywhere
An extension that enables spell checking within any Visual Studio file editor or tool window that uses WPF text boxes.
https://GitHub.com/EWSoftware/VSSpellChecker
Visual Studio Spell Checker VSSpellChecker
An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with tool windows.
https://GitHub.com/EWSoftware/VSSpellChecker
Visual Studio Tools for Unity 17.3.0.0
Visual Studio Tools for Unity
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSColorOutput64 2022.2
Color output for build and debug windows - https://mike-ward.net/vscoloroutput
Xamarin 17.3.0.296 (d17-3@a0ff24b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.3.0.208 (remotes/origin/d17-3@e4f67afef)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.2.28 (9b3d244)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.0.0.0 (d17-3/030cd63)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite/3.38.5@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6
Xamarin.iOS and Xamarin.Mac SDK 15.12.0.2 (87f98a75e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
A quick look says my local files are from the following, with each link highlighting the offending lines:
1. [Microsoft.FSharp.Shim.targets](https://github.com/dotnet/fsharp/blob/3bd6eb1438955b3268ea2a6e7fc64e6a353cf914/vsintegration/shims/Microsoft.FSharp.Shim.targets#L4)
1. [Microsoft.FSharp.NetSdk.targets](https://github.com/dotnet/fsharp/blob/3bd6eb1438955b3268ea2a6e7fc64e6a353cf914/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets#L46)
Contributor guide
Assessment
This issue has not been assessed yet.