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

Ignoring multiple imports #910

Closed
mhutch opened this issue Aug 17, 2016 · 5 comments
Closed

Ignoring multiple imports #910

mhutch opened this issue Aug 17, 2016 · 5 comments
Assignees
Labels

Comments

@mhutch
Copy link
Member

mhutch commented Aug 17, 2016

Importing a target/props file multiple times causes a MSB4011 warning. The only mechanism to avoid it is to condition the import to happen only when some property is empty. This places the burden on the importer, and cannot be done for transitive imports.

I propose that a mechanism is added for project files to suppress this warning:

<Project DefaultTargets="Build" ToolsVersion="15.0" IgnoreMultipleImport="true">
@rainersigwald
Copy link
Member

Do you envision this having an effect other than silencing the warning MSB4011 : "{0}" cannot be imported again. It was already imported at "{1}". This is most likely a build authoring error. This subsequent import will be ignored.?

@mhutch
Copy link
Member Author

mhutch commented Aug 17, 2016

Ah, my bad, xbuild does not have that warning and after the mailing list post I assumed msbuild had the same issue.

So yes, it would just silence the warning.

[edited the issue]

@radical
Copy link
Member

radical commented Aug 18, 2016

xbuild does emit that warning:

/Users/ankit/test/msbuild/time.proj: warning : Cannot import project 'time2.proj' again. It was already imported by '/Users/ankit/test/msbuild/time.proj'. Ignoring.

@mhutch
Copy link
Member Author

mhutch commented Aug 18, 2016

Sorry, guess I misremembered :)

@jeffkl jeffkl self-assigned this Nov 21, 2016
@jeffkl
Copy link
Contributor

jeffkl commented Nov 21, 2016

You will be able to at least suppress this when I close #68 😄

jeffkl added a commit that referenced this issue Nov 29, 2016
You cannot suppress all warnings, if you specify empty `/warnasmessage` or `/nowarn`, you get an error message.
Warnings are mutated into just a message.
Ignore the first commit which is the implementation of /WarnAsError

Closes #68
Closes #47
Closes #910 

So this:
```
MyProject.proj(3,18): warning MSB4130: The condition "true or true and true" may have been evaluated incorrectly 
in an earlier version of MSBuild. Please verify that the order of the AND and OR clauses is written as intended. To 
avoid this warning, add parentheses to make the evaluation order explicit.
```
Becomes this in with Verbosity=Detailed 
```
MyProject.proj(3,18): message MSB4130: The condition "true or true and true" may have been evaluated incorrectly
in an earlier version of MSBuild. Please verify that the order of the AND and OR clauses is written as intended. To
avoid this warning, add parentheses to make the evaluation order explicit.
```

Here is the help message for review:
```
  /warnasmessage[:code[;code2]]
                     List of warning codes to treats as low importance
                     messages.  Use a semicolon or a comma to separate
                     multiple warning codes.
                     (Short form: /nowarn[:c;[c2]])

                     Example:
                       /warnasmessage:MSB3026
```
@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

5 participants