dotnet / dotnet/sdk

dotnet-format always loads projects Debug configuration

Open
#51,529 0 comments 2 reactions 0 assignees View on GitHub
Area-Format untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

I have a project where tasks are loading from a path that depends on the project configuration

```xml

$(MSBuildThisFileDirectory)bin\$(Configuration)\netstandard2.0\ZeroC.Ice.Slice.Tools.dll

```

For my build I set the default configuration to Release, like:

```xml

Release

```

This is included by the `Directory.Build.props` and apply to all my projects, things work as expected with `dotnet build`, with `dotnet format` it fails because configuration is set to `Debug` even if the projects have a default to `Release`.

When running `dotnet format` it complains because the custom task from my build cannot be loaded:

```
Msbuild failed when processing the file 'C:\Users\jose\source\repos\3.8\ice\csharp\src\Ice\Ice.csproj' with message: The "ZeroC.Ice.Slice.Tools.Slice2CSharpDependTask" task could not be loaded from the assembly C:\Users\jose\source\repos\3.8\ice\csharp\tools\ZeroC.Ice.Slice.Tools\bin\Debug\netstandard2.0\ZeroC.Ice.Slice.Tools.dll. Could not load file or assembly 'C:\Users\jose\source\repos\3.8\ice\csharp\tools\ZeroC.Ice.Slice.Tools\bin\Debug\netstandard2.0\ZeroC.Ice.Slice.Tools.dll'. The system cannot find the path specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.