mellinoe / vk

Low-level Vulkan bindings for .NET.
Other
176 stars 35 forks source link

Build issues #15

Open taumuon opened 6 years ago

taumuon commented 6 years ago

Hi, I cloned the repository and followed the build instructions but ran into some issues. I have dotnet sdk 2.1.4 installed. On attempting to restore I got an error: D:\git\mellinoe\vk\src\samples\tutorial\tutorial.csproj : error NU1102: Unable to find package SixLabors.ImageSharp with version (>= 1.0.0-ci0027) [D:\git\mellinoe\vk\src\vk.sln] I modified the tutorial.csproj to reference SixLabors.ImageSharp version 1.0.0-beta0003, and that had a knock-on effect that I had to reference System.Runtime.CompilerServices.Unsafe version 4.5.0-preview1-26216-02.

After that the restore worked, but then the build failed:

D:\git\mellinoe\vk>dotnet msbuild src\vk\vk.csproj Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

The application to execute does not exist: 'D:\git\mellinoe\vk\bin\Debug\vk.generator\netcoreapp2.0\vk.generator.dll'

D:\git\mellinoe\vk\src\vk\vk.csproj(32,5): error MSB3073: The command "dotnet D:\git\mellinoe\vk\bin/Debug/vk.generator/netcoreapp2.0/vk.generator.dll --out D:\git\mellinoe\vk\src\vk\Generated" exited with code -2147450751.

Thanks, Gary

taumuon commented 6 years ago

Hi, the project builds OK if I first open the solution and ensure that vk.generator project is build. The dotnet msbuild commands now work, but I get an error when trying to build the solution in Visual Studio: 9>------ Build started: Project: tutorial, Configuration: Debug Any CPU ------ 9>C:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5): error : Assets file 'D:\git\mellinoe\vk\bin\obj\tutorial\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v1.1/win7-x64'. Ensure that restore has run and that you have included 'netcoreapp1.1' in the TargetFrameworks for your project. You may also need to include 'win7-x64' in your project's RuntimeIdentifiers. 9>Done building project "tutorial.csproj" -- FAILED.

Thanks, Gary

mellinoe commented 6 years ago

It seems like some of the sample projects were broken by an SDK update. Unfortunately, I'm out of town at the moment so I can't immediately fix some of this stuff. It shouldn't be too terribly difficult to work through, though. The samples in here definitely deserve some love, they have gotten pretty stale with old package references (ImageSharp) and things from the early days of .NET Core (all those extra properties in the project files). I've been focused on other graphics-related projects using Vulkan, so these sample projects kind of fell off my radar. I won't be able to get them tested for a couple weeks, most likely.

I took a crack at what the cleanup might look like, without changing too much. I didn't test this, as I only have my MacBook which doesn't support Vulkan. Even if this doesn't work, it might help you get started on something that does. This is a fixed-up tutorial.csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <OutputType>Exe</OutputType>
    <RootNamespace>Vk.Samples</RootNamespace>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
  <ItemGroup>
    <Content Include="Shaders\shader.frag.spv">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Shaders\shader.vert.spv">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Textures\texture.jpg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="../../vk/vk.csproj" />
    <ProjectReference Include="..\..\..\ext\veldrid.collections\src\Veldrid.Collections\Veldrid.Collections.csproj" />
    <PackageReference Include="System.CommandLine" Version="0.1.0-e160908-1" />
    <PackageReference Include="OpenTK.NETCore" Version="1.1.2287.6424" />
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" />
    <PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-ci0027" />
  </ItemGroup>
</Project>