Sdk: dotnet run looks for net451 reference assemblies when trying to run netcoreapp1.0

Created on 17 Jun 2016  路  8Comments  路  Source: dotnet/sdk

Start with an app that targets net451 and netcoreapp1.0. Run dotnet restore, followed by dotnet run -f netcoreapp1.0.

Expected:
App runs with netcoreapp1.0

Actual:
dotnet run fails with

The current project is not valid because of the following errors:
/home/release/test111/project.json(0,0): error DOTNET1012: The reference assemblies directory was not specified. You can set the location using the DOTNET_REFERENCE_ASSEMBLIES_PATH environment variable. 

Removing net451 from the project.json and re-running after restoring fixes this. Perhaps it should check for reference assemblies later on?

 ~/.dotnet/dotnet --info
.NET Command Line Tools (1.0.0-preview2-003119)

Product Information:
 Version:            1.0.0-preview2-003119
 Commit SHA-1 hash:  0708fe095e

Runtime Environment:
 OS Name:     centos
 OS Version:  7
 OS Platform: Linux
 RID:         centos.7-x64

Most helpful comment

I've found a simple workaround for this issue:
mkdir -p /usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5.1

There's no need to actually install mono. Just create a folder for the .Net framework version you "need", and publish using -f netcoreapp1.0. It will succeed.

If you want to create a complete list of available frameworks, the Debian package xbuild-frameworks 4.6.2.7-0xamarin2 contains the following:

root@2b4c894ee4a0:/usr/lib/mono/xbuild-frameworks/.NETFramework# ls
v2.0  v3.0  v3.5  v4.0  v4.5  v4.5.1  v4.5.2  v4.6  v4.6.1

All 8 comments

I have the same problem on Ubuntu 14 , using the same version of preview2 tooling. And I can't use preview1 tooling, because it crashes with segmentation fault when dotnet is started.

Similar issue with publish, for me it happens when there is a project dependency that uses net46. dotnet/cli#3648

If see something similar, for example with the musicstore app.

project.json:

  "frameworks": {                              
    "net451": {},                              
    "netcoreapp1.0": {                         
      "dependencies": {                        
        "Microsoft.NETCore.App": {             
          "version": "1.1.0-*",                
          "type": "platform"                   
        }                                      
      }                                        
    }                                          
  },

dotnet build -f netcoreapp1.0 works fine, but run fails:

 dotnet run -f netcoreapp1.0
The current project is not valid because of the following errors:
C:\MusicStore\samples\MusicStore\project.json(61,15): error DOTNET1011: Framework not installed: .NETFramework,Version=v4.5.1 in

Just tested this with preview3. I have a csproj with netcoreapp1.0 and net451 on OS X. dotnet run --framework netcoreapp1.0 works just fine. I also did make sure to remove mono before testing.

It would be really great to get a patch for this issue for preview2, i.e. project.json. Everything I've read warns that msbuild/csproj is alpha code and shouldn't be used for production projects. My team is working to multi-target Docker on Linux with netcoreapp, and Windows with net452. We're not ready to move to msbuild/csproj, but need working builds for netcoreapp.

Would you reconsider labeling this issue resolved?

I've found a simple workaround for this issue:
mkdir -p /usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5.1

There's no need to actually install mono. Just create a folder for the .Net framework version you "need", and publish using -f netcoreapp1.0. It will succeed.

If you want to create a complete list of available frameworks, the Debian package xbuild-frameworks 4.6.2.7-0xamarin2 contains the following:

root@2b4c894ee4a0:/usr/lib/mono/xbuild-frameworks/.NETFramework# ls
v2.0  v3.0  v3.5  v4.0  v4.5  v4.5.1  v4.5.2  v4.6  v4.6.1

@piotrpMSFT - this appears to still be occurring, and @ddrinka's workaround seems to fix, but should not be required, IMHO. Please re-open.

I am using Ubuntu, BTW, not OSX, and it specifically occurs during a dotnet publish, unless the directories exist. dotnet build seems to work fine.

Was this page helpful?
0 / 5 - 0 ratings