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

PostBuildEvent uses ProjectName in command #30

Closed
bartdonninger opened this issue Jan 6, 2025 · 2 comments
Closed

PostBuildEvent uses ProjectName in command #30

bartdonninger opened this issue Jan 6, 2025 · 2 comments

Comments

@bartdonninger
Copy link
Contributor

Hello,

First of all thanks for creating and sharing this package.

I want to try and use the package in our test projects. When adding the package, my test project is not able to build anymore. The following error occurs:

13>MockMe.targets(24,5): Error MSB3073 : The command "dotnet --roll-forward Major "C:\Users\donni\.nuget\packages\mockme\1.0.2\build\..\lib\net6.0\MockMe.PostBuild.dll" "C:\Repos\Test\Backend\Domain.Tests\bin\Debug\net8.0\Praktijkdata.Domain.Tests.dll"" exited with code -532462766

This error occurs because a FileNotFound exception occurs. In my solution the projectname and assemblyname are not the same. The PostBuildEvent references the ProjectName variable and fails to find the assembly. E.g. my project name is 'Domain.Tests' and the generated assembly is 'CompanyX.Domain.Test.dll'.

<Target Name="ReplaceGenericMethods" AfterTargets="PostBuildEvent">
    <Exec Command='dotnet --roll-forward Major "$(MockMePath)MockMe.PostBuild.dll" "$(MSBuildProjectDirectory)\$(OutputPath)$(ProjectName).dll"' />
  </Target>

Using the $(AssemblyName) variable might fix this issue.

@bartdonninger
Copy link
Contributor Author

I tested if it works when changed to $(AssemblyName). This works for my scenario, so i opened a PR for it. #31.

@connorivy
Copy link
Owner

Fixed in 1.0.3 release. Thanks for the reporting this issue and providing a fix. Please let me know if you run into any more issues

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

2 participants