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

When using msbuild for a solution containing multiple projects, with the /p:ErrorLog parameter, it only saves Roslyn Analyzers' results for the last project but not for the other projects. #24319

Closed
JiandongJiang opened this issue Jan 18, 2018 · 4 comments

Comments

@JiandongJiang
Copy link

Version Used: MSBuild.exe v14.0 and v15.0

Steps to Reproduce:

  1. Create a solution and add more than one C# project to it.
  2. Create a .targets which includes some paths to the Roslyn analyzers, and save it in the folder $(MSBuildUserExtensionsPath)$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter
  3. Run a MSBuild command line, like this:
    MSBuild.exe SolutionWithMultipleProjects.sln [options] /p:ErrorLog=OutputName.sarif
  4. Check the analysis results in the output OutputName.sarif.

Expected Behavior:
/p:ErrorLog will save the Roslyn analysis results for all the projects in a solution.

Actual Behavior:
/p:ErrorLog only saves the Roslyn analysis results for the last project.

@mavasani
Copy link
Member

mavasani commented Jan 18, 2018

Note the effective ask here is for /errorlog compiler switch to append to the given error log file as opposed to overwrite.

Workaround for the customer is to use separate error log files per-project, but they would prefer generating a single error log file for the entire solution.

@mattdesai
Copy link

Thanks, Manish.
To clarify this is more of a blocking issue for us, than a preference. We cannot easily call MSBuild once per project; we're just 'replaying' the MSBuild cmd that was done earlier in the build.

@jinujoseph
Copy link
Contributor

@jcouv for triaging

@mavasani
Copy link
Member

FYI: The following workaround resolved this issue and we don't need this feature request anymore:

Are you guys on MSBuild 15+? If so, https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build might be the simplest solution for your problem. Just define a props at the root directory of the solution that sets the property ErrorLog to “$(MSBuildProjectFullPath).json”

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