Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Glenn
    @glennawatson

    hi, not sure if this is the correct place to chat

    So I am fixing my project to compile for both VS 4 Mac/VS 4 Windows

    At the moment got most projects compiling with

        <TargetFrameworks>netstandard2.0;net461;uap10.0.16299;Xamarin.iOS10;Xamarin.Mac20;Xamarin.TVOS10;MonoAndroid81;netcoreapp2.0;tizen40</TargetFrameworks>
        <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;Xamarin.TVOS10;MonoAndroid81;netcoreapp2.0;tizen40</TargetFrameworks>

    So for non windows I exclude net461/uap (using MsBuild.Sdk.Extras btw hence the extra TargetFrameworks.

    My question is how can I exclude a project from compiling altogether for a non-windows build. Eg I got a uap/net461 only project. Can I do the condition on the project level? I know I could take the approach of a separate .sln file but that's a last resort for me

    also another question I have is I am a bit confused by the relationship of the .net SDK and msbuild

    Eg to get LicenseExpression tag working I need to have installed .net core 2.1 onwards, even though my project is targetting netcoreapp2.0

    Does the .net sdk provide some sort of templates for msbuild?

    ProjectLicenseExpression rather (or whatever the new nuget csproj tags are)
    Glenn
    @glennawatson
    might ask on home
    jp2masa
    @jp2masa
    that's because NuGet ships with the .NET SDK, including the build targets
    jp2masa
    @jp2masa

    to disable compilation, you can try something like conditionally importing a targets file (in Directory.Build.targets), for example DisableTargets.targets, and then overriding default build targets, something like this:
    Directory.Build.targets:

    ...
      <Import Project="DisableTargets.targets" Condition="'$(DisableTargets)' == 'true'" />
    ...

    DisableTargets.targets:

    <Project>
      <Target Name="Build" />
    </Project>
    Glenn
    @glennawatson
    Hmm cool thanks
    That sounds like a good solution
    Glenn
    @glennawatson
    I think that solution simplifies having to declare the Target framework twice also
    jp2masa
    @jp2masa
    for the target frameworks you could do this as well:
        <TargetFrameworks>netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;Xamarin.TVOS10;MonoAndroid81;netcoreapp2.0;tizen40</TargetFrameworks>
        <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net461;uap10.0.16299</TargetFrameworks>
    Glenn
    @glennawatson
    Thanks

    I am considering doing like

    <Import Project="DisableTargets.targets" Condition="'$(TargetFramework.StartsWith('net4')) and '$(OS)' != 'Windows_NT'" />

    In my Directory.Build.Targets

    not sure if I have access to the TargetFramework at that time though
    regardless I have enough information to get a clean solution now
    Jonathon Marolf
    @jmarolf
    @glennawatson is there a reason you can't just target only netstandard2.0?
    Glenn
    @glennawatson
    WPF/UWP projects
    this is a cross platform MVVM project, which targets UWP/WPF/Xamarin
    and the solution above worked
    so now able to keep my TargetFrameworks the original way and just use the disable target
    Jonathon Marolf
    @jmarolf
    with UI code I assume?
    Glenn
    @glennawatson

    some

    We use the target frameworks to include different directories in our platform folder

      <ItemGroup>
        <Compile Remove="Platforms\**\*.cs" />
        <None Include="Platforms\**\*.cs" />
     </ItemGroup>
    
     <ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
        <Compile Include="Platforms\netstandard2.0\**\*.cs" />
      </ItemGroup>
      <ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) ">
        <Compile Include="Platforms\net461\**\*.cs" />
      </ItemGroup>

    So it gets isolated off

    with .net core 3 we are going to have to use nuget transitive feature, since at the moment we have to include both UseWPF/UseUWP etc https://github.com/NuGet/Home/wiki/Allow-package--authors-to-define-build-assets-transitive-behavior
    that's the advice we been given by the guy working on the .net core 3 stuff
    Paul M Cohen
    @paul1956
    Is this the correct library to build a VBProj file outside of visual studio? I want to create a project file from scratch to compile a set of VB files into a dll. If so are there any example of doing so, if not does anything exist. I use MsBuild Workspace to read one, I want to transform what I get into something else.
    Using Workspace As MSBuildWorkspace = MSBuildWorkspace.Create()
        Dim currentProject As Project = Workspace.OpenProjectAsync(FileName).Result
        Workspace.LoadMetadataForReferencedProjects = True
         If currentProject.HasDocuments Then
             For Each document As Document In currentProject.Documents
    Paul M Cohen
    @paul1956
    Is the issue that the value Title set in framework through VS UI Properties/Application/AssemblyInfo/Title not available in Package UI a Project issue, a core issue or something else?
    image.png
    Johan Larsson
    @JohanLarsson
    <ItemGroup>
      <None Remove="stylecop.json" />
      <AdditionalFiles Include="stylecop.json" />
    </ItemGroup>
    Is there a time when none remove is needed?
    wd40bomber7
    @wd40bomber7
    Hey folks, I'm missing something fundamental about how to interact with the CPS in VSIX. It is my understanding the CPS is used by default by VS2019 for .net projects. I'm trying to add a deploy step using a .vsix. I added a reference to the Mirosoft.VisualStudio.ProjectSystem nuget, and System.Composition but otherwise more or less C&P'd the example from here: https://github.com/microsoft/VSProjectSystem/blob/master/doc/extensibility/IDeployProvider.md but nothing happens when the VSIX is loaded.
    Tal
    @t1a2l
    Hello, i need help
    if i change my targetframework to "net35" i can't load my project
    i get this error:
    The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(_, net35, '', '', '', '')" cannot be evaluated. Version string portion was too short or too long.