Git Product home page Git Product logo

Comments (8)

mmitche avatar mmitche commented on May 26, 2024

@markwilkie Any idea what the status of this is?

from arcade.

natemcmaster avatar natemcmaster commented on May 26, 2024

cc @ryanbrandenburg - this is relevant to the .Sources stuff in aspnet/Extensions.

from arcade.

ryanbrandenburg avatar ryanbrandenburg commented on May 26, 2024

Yeah, I brought it up :)

from arcade.

markwilkie avatar markwilkie commented on May 26, 2024

The status is that this was not a priority - until this thread of course.... The first thing is to come up with what we think should happen. Then we can go about finding out the best way to fund it....

from arcade.

tmat avatar tmat commented on May 26, 2024

I'm not sure what the actual issue is. As @jaredpar pointed out we use shared projects in Roslyn and we have seen no issues.

from arcade.

natemcmaster avatar natemcmaster commented on May 26, 2024

The problem is basically that you can't use .shproj to represent a package of shared source. ASP.NET and others, like the System.Text.Json team, want to produce 'shared source' NuGet packages which only contain C# in contentFiles/cs/any/.

The reason you can't do this boils down to 2 limitations in MSBuild.

  1. Solution files don't actually build .shproj files. Here's an example .sln file that only has a .shproj in it. As you'll see, this project does not appear in the section GlobalSection(ProjectConfigurationPlatforms) which defines the list of projects that actually compile.

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedProject1", "SharedProject1\SharedProject1.shproj", "{048A3DB6-363C-4CCA-A4B5-CDF3DDDD896C}"
EndProject
Global
	GlobalSection(SharedMSBuildProjectFiles) = preSolution
		SharedProject1\SharedProject1.projitems*{048a3db6-363c-4cca-a4b5-cdf3dddd896c}*SharedItemsImports = 13
	EndGlobalSection
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {83C46E69-85C3-4C0A-91D1-ECF6191F9673}
	EndGlobalSection
EndGlobal

  1. dotnet msbuild MyProj.shproj doesn't work.
PS > dotnet msbuild .\SharedProject1\SharedProject1.shproj
Microsoft (R) Build Engine version 15.9.19+g938f3292a0 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

C:\tmp\shpr\SharedProject1\SharedProject1.shproj(8,3): error MSB4019: The imported project "C:\Users\namc\.dotnet\x64\sdk\3.0.100-preview-009750\Microsoft\VisualStudio\v15.0\CodeSharing\Microsoft.CodeSharing.Common.Default.props" was not found. Confirm that the path in the <Import> declaration
is correct, and that the file exists on disk.

from arcade.

natemcmaster avatar natemcmaster commented on May 26, 2024

Two ideas for working around this:

  1. Create a dummy ‘.csproj’ file for each shared sources package. This dummy project needs to strip out the C# compiler targets since it shouldn't make an assembly. This is basically what we did in KoreBuild. AFAIK it’s the only way to get Visual Studio, dotnet.exe, and NuGet's packing targets to play nice. Projects in the same repo then need to add <Compile> item groups to point to the folders of code they need as <ProjectReference> won't work.
  2. Change aspnet/Extensions to build a list of projects, not a .sln file, and implement some targets for .shproj files which don't require full MSBuild. This one is probably the more expensive option, but I think would lead to a nice project convention for shared sources.

from arcade.

tmat avatar tmat commented on May 26, 2024

We did [1], but we keep the assembly building.
See e.g.: https://github.com/dotnet/roslyn/tree/master/src/Dependencies/PooledObjects

The reason why you might want to build the assembly is to validate that the source files can be built against given TFM. For example, we want the source files to be buildable in projects that target netstandard1.3.

This is a targets file that these packages include:
https://github.com/dotnet/roslyn/blob/master/eng/targets/SourcePackage.targets

Other than setting some properties to tweak the build, we also generate Source Link information that is included in the NuGet package, so that the sources can be debugged. I want to move this logic to Source Link package at some point. Haven't had time to do so yet.

from arcade.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.