You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to know why "dotnet clean" depends on project.assets.json file. This new behavior in 2.0 is something we can work around, but I would like to understand why this change in behavior was introduced and what is the project structure expectation of dotnet cli.
Is multiple .csproj files in a single directory not supported/encouraged?
Steps to reproduce
In our project, we have this folder structure for historical reasons:
Both .csproj are in the new vs2017 csproj format that starts with <Project Sdk="Microsoft.NET.Sdk">
Expected behavior
The above folder structure worked pre-2.0 because "dotnet clean" command did not take a dependency/make a reference to project.assets.json file and succeeded.
Actual behavior
With 2.0, we see the following error message during dotnet clean:
C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file 'd:\workspace\Project\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v4.5'. Ensure that restore has run and that
you have included 'net45' in the TargetFrameworks for your project. [d:\workspace\Project\Project.Net45.csproj] [
d:\workspace\build.proj]
I think we can workaround this by specifying different obj directory per project or doing dotnet restore -f before dotnet clean. Ideally, we would build for both frameworks in a single .csproj, but it's not something we can invest time in currently.
Environment data
dotnet --info output:
.NET Command Line Tools (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
The text was updated successfully, but these errors were encountered:
@sstevenkang you are facing this problem because you have 2 different csproj files in the same folder. You can workaround this by adding a --Force to the restore calls which will result in rewriting of the assets file each time.
I would like to know why "dotnet clean" depends on project.assets.json file. This new behavior in 2.0 is something we can work around, but I would like to understand why this change in behavior was introduced and what is the project structure expectation of dotnet cli.
Is multiple .csproj files in a single directory not supported/encouraged?
Steps to reproduce
In our project, we have this folder structure for historical reasons:
Pre 2.0, we used to do following commands in sequence:
Both .csproj are in the new vs2017 csproj format that starts with
<Project Sdk="Microsoft.NET.Sdk">
Expected behavior
The above folder structure worked pre-2.0 because "dotnet clean" command did not take a dependency/make a reference to project.assets.json file and succeeded.
Actual behavior
With 2.0, we see the following error message during
dotnet clean
:I think we can workaround this by specifying different
obj
directory per project or doingdotnet restore -f
beforedotnet clean
. Ideally, we would build for both frameworks in a single .csproj, but it's not something we can invest time in currently.Environment data
dotnet --info
output:The text was updated successfully, but these errors were encountered: