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

BenchmarkDotNet.Autogenerated doesn't have build events from original project #1956

Closed
campelo opened this issue Mar 21, 2022 · 4 comments
Closed

Comments

@campelo
Copy link

campelo commented Mar 21, 2022

Hi everyone!

I have a POC application that has to copy some files for benchmark measures. So, I would like to copy some assets to outdir using build events. But when I'm using benchmark, I receive an error where all files are missing. Of course, because those files weren't copied to the target (output dir). So for the moment my post build event is copying all files for a dir on my root folder C:\ but it's not the best solution.

Do you have any suggestion for that?

I looked on the BenchmarkDotNet.Autogenerated.csproj, and I'm not certain if we could add the original post build events on the benchmark project to solve this.

Here's some piece of my original cs project file.

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="XCOPY /YEIRD &quot;$(ProjectDir)Ressources\&quot; &quot;$(OutDir)\AssetFiles&quot;" />
</Target>

And here is the BenchmarkDotNet.Autogenerated.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
    <ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
    <AssemblyTitle>79f859be-68d2-4927-a53a-ba12ea0b4908</AssemblyTitle>
    <TargetFramework>net6.0</TargetFramework>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <PlatformTarget>x64</PlatformTarget>
    <AssemblyName>79f859be-68d2-4927-a53a-ba12ea0b4908</AssemblyName>
    <OutputType>Exe</OutputType>
    <OutputPath>bin\Release</OutputPath>
    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
    <DebugType>pdbonly</DebugType>
    <DebugSymbols>true</DebugSymbols>
    <UseSharedCompilation>false</UseSharedCompilation>
    <CodeAnalysisRuleSet></CodeAnalysisRuleSet>
    <Deterministic>true</Deterministic>
    <!-- needed for custom build configurations (only "Release" builds are optimized by default) -->
    <Optimize Condition=" '$(Configuration)' != 'Debug' ">true</Optimize>
    
    <!-- we set LangVersion after  which might contain LangVersion copied from the benchmarks project -->
    <LangVersion Condition="'$(LangVersion)' == '' Or ($([System.Char]::IsDigit('$(LangVersion)', 0)) And '$(LangVersion)' &lt; '7.3')">latest</LangVersion>
    <AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="79f859be-68d2-4927-a53a-ba12ea0b4908.notcs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="C:\Users\Flavio\repos\FindFiles\FindFiles\FindFiles.csproj" />
  </ItemGroup>
  <PropertyGroup>
<ServerGarbageCollection>false</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
</PropertyGroup>


</Project>
@OlegOLK
Copy link
Contributor

OlegOLK commented Apr 1, 2022

Upvote for this.
Due to this error https://docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/5.0/referencing-executable-generates-error
Recommended fix is not working for our solution due to missing properties in autogenerated .csproj

@corvio
Copy link

corvio commented Nov 10, 2022

I am facing the same issues ( post build step not executed) .
Any idea how to solve this ?

@timcassell
Copy link
Collaborator

Another case that should be fixed by #1403.

@timcassell
Copy link
Collaborator

This should be fixed in v0.14.0. If it is not, let us know and we can re-open.

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

No branches or pull requests

4 participants