Using custom build task in net5.0 project and building the project through VS #6692
Unanswered
persiandeveloper
asked this question in
Q&A
Replies: 1 comment
-
Perhaps you could move the JSON code to a separate executable program and start that from SnykTask. This way, SnykTask could target .NET Standard 2.0, and the separate process would be able to use .NET 5.0 even if MSBuild is running on .NET Framework. This might require large changes in your code, though. I suggest adding |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Recently I had issues using a custom build task in a .net core 5.0 project. I got an answer from this .
My Code is accessible here .
If I clean the target project and try to rebuild, I have to clear the following part first :
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <SnykTaskFile Location="$(ProjectDir)" /> </Target>
Then I have to build it, otherwise I get the following error :
The "SnykTaskFile" task could not be loaded from the assembly D:\2021\customTask\Application\bin\Debug\net5.0\SnykTask.dll
Which makes sense because the 'SnykTask.dll' is not there.
My question is, how should I reference the CustomTask library into target project so I do not need to the the above steps each time.
But there is more serious issue when I build this same solution in another pc, I get the following error :
In this case, I have to clean project, remove
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
, and build it, build fails in Visual Studio and still shows the above message, how ever "dotnet build" command works properly.Update
I fund out that the issue is "System.Text.Json" If use "newtonsoft" it works. However still do not know how can I use "System.Text.Json" not "newtonsoft"
Beta Was this translation helpful? Give feedback.
All reactions