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

[BuildCheck] BC0102 doesn't work for task WriteLinesToFile #10439

Open
GangWang01 opened this issue Jul 24, 2024 · 3 comments
Open

[BuildCheck] BC0102 doesn't work for task WriteLinesToFile #10439

GangWang01 opened this issue Jul 24, 2024 · 3 comments
Labels

Comments

@GangWang01
Copy link
Member

The following two projects both have a task WriteLinesToFile that write some content to the same files. Building proj1.csproj with analyzer enabled doesn't get the expected warning BC0102. See binlog.zip for details.

proj1.csproj

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="CreateOutputFile">
        <Message Importance="High" Text="Creating file from project 1------------------------------" />
        <WriteLinesToFile
            File=".\testfile.txt"
            Lines="content from project 1"
            Overwrite="true" />
        <MSBuild Projects=".\proj2.csproj" Targets="CreateOutputFile" />
    </Target>
</Project>

proj2.csproj

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="CreateOutputFile">
        <Message Importance="High" Text="Creating file from project 2------------------------------" />
        <WriteLinesToFile
            File=".\testfile.txt"
            Lines="content from project 2"
            Overwrite="true" />
    </Target>
</Project>
@JaynieBai
Copy link
Member

The UnzipFiles task is not recognized by the check either
`

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
</PropertyGroup>
  
<Target Name="Hello">     
    <Unzip
    SourceFiles="MyArchive.zip"
    DestinationFolder="unzipped"
    OverwriteReadOnlyFiles="true"
    />
    <Unzip
        SourceFiles="MyArchive.zip"
        DestinationFolder="unzipped"
        OverwriteReadOnlyFiles="true"
    />
</Target>

`

@JaynieBai
Copy link
Member

The following write tasks are not recognized by the check
Move
WriteCodeFragment
XmlPoke
XslTransformation

@rainersigwald
Copy link
Member

IMO Move is the only one on that list that particularly concerns me.

@AR-May AR-May added the triaged label Jul 30, 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