Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open custom SDK project in Visual Studio #18

Closed
DoCode opened this issue Mar 30, 2018 · 12 comments
Closed

Open custom SDK project in Visual Studio #18

DoCode opened this issue Mar 30, 2018 · 12 comments

Comments

@DoCode
Copy link

DoCode commented Mar 30, 2018

Is it the expected behavior, that a custom SDK project cannot be opened inside VS?
Or goes something wrong on my machine...

@jeffkl
Copy link
Contributor

jeffkl commented Mar 30, 2018

It will work in Visual Studio 15.6+ only. What version of Visual Studio do you have? What exactly is the error message you're seeing?

@DoCode
Copy link
Author

DoCode commented Mar 30, 2018

@jeffkl
I use the latest VS preview

image

This error occours when I reference the SDK as a Project SDK like this <Project Sdk="My.Custom.SDK">

image

The error log from the message above

=====================
30.03.2018 17:31:24
LimitedFunctionality
System.AggregateException: Project system data flow 'DebugTargetsSubscriptionService: 81150' closed because of an exception: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: catalog
   at Microsoft.Requires.NotNull[T](T value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.<LinkExternalInput>b__42_2(Tuple`2 bunch)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.ProcessMessage(Func`2 transform, KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.<>c__DisplayClass10.<.ctor>b__3(KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.Internal.TargetCore`1.ProcessMessagesLoopCore()
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: catalog
   at Microsoft.Requires.NotNull[T](T value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.<LinkExternalInput>b__42_2(Tuple`2 bunch)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.ProcessMessage(Func`2 transform, KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.<>c__DisplayClass10.<.ctor>b__3(KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.Internal.TargetCore`1.ProcessMessagesLoopCore()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
Parameter name: catalog
   at Microsoft.Requires.NotNull[T](T value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.<LinkExternalInput>b__42_2(Tuple`2 bunch)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.ProcessMessage(Func`2 transform, KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.<>c__DisplayClass10.<.ctor>b__3(KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.Internal.TargetCore`1.ProcessMessagesLoopCore()<---
<---
 ---> System.ArgumentNullException: Value cannot be null.
Parameter name: catalog
   at Microsoft.Requires.NotNull[T](T value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.<LinkExternalInput>b__42_2(Tuple`2 bunch)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.ProcessMessage(Func`2 transform, KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.<>c__DisplayClass10.<.ctor>b__3(KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.Internal.TargetCore`1.ProcessMessagesLoopCore()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
Parameter name: catalog
   at Microsoft.Requires.NotNull[T](T value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.<LinkExternalInput>b__42_2(Tuple`2 bunch)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.ProcessMessage(Func`2 transform, KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.TransformBlock`2.<>c__DisplayClass10.<.ctor>b__3(KeyValuePair`2 messageWithId)
   at System.Threading.Tasks.Dataflow.Internal.TargetCore`1.ProcessMessagesLoopCore()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )<---

===================

Visual Studio output window from solutions says

test-consume-custom-sdk.csproj : error  : Project file is incomplete. Expected imports are missing.

@jeffkl
Copy link
Contributor

jeffkl commented Mar 30, 2018

That looks like some problem with the Visual Studio project system. I have a newer internal preview installed and it seems to be working. Do you have a non-Preview installation of Visual Studio on your machine that you can try?

@DoCode
Copy link
Author

DoCode commented Mar 30, 2018

Hmmm. It would so nice when I also have this working internal preview ;-)

Have the exact same issue with this build:

image

@jeffkl
Copy link
Contributor

jeffkl commented Mar 30, 2018

If its broken in 15.6.4, there's more going on than just MSBuild SDK resolution.

@davkean should I route this to project system? Or do you know who would be the appropriate people to route it to?

@DoCode
Copy link
Author

DoCode commented Apr 3, 2018

@jeffkl @davkean any news here?

@DoCode
Copy link
Author

DoCode commented Apr 5, 2018

So, Visual Studio from yesterday 15.6.5 doesn't work.
Also, 15.7 Preview 2 doesn't work.

@jeffkl
Copy link
Contributor

jeffkl commented Apr 5, 2018

Can you provide some exact repro steps? I can try to debug it if I can get it to happen.

@DoCode
Copy link
Author

DoCode commented Apr 5, 2018

Sure, very simple.
Create a new project without any other pieces of information inside the csproj file.
Then switch from <Project Sdk="Microsoft.NET.Sdk"> to <Project Sdk="Microsoft.Build.NoTargets">.
And now all latest Visual Studio's 15.6.5 and 15.7 Preview 2 cannot open the csproj anymore.

@jeffkl
Copy link
Contributor

jeffkl commented Apr 5, 2018

Okay that sounds like #20 which I'm working on fixing!

@DoCode
Copy link
Author

DoCode commented Apr 5, 2018

Okay, thanks. Then we wait to adopt this one...

@jeffkl jeffkl closed this as completed in #23 Apr 6, 2018
jeffkl added a commit that referenced this issue Apr 6, 2018
Recent versions of Visual Studio require imports and properties otherwise it will migrate the project to a legacy project.

I'm adding imports to the Microsoft.NET.Sdk and users will have to specify a TargetFramework in their projects.  I also updated the README to reflect this.

* Added common library for unit tests
* Add unit tests for NoTargets

Fixes #18
Fixes #20
@jeffkl
Copy link
Contributor

jeffkl commented Apr 6, 2018

I've fixed the SDK but you now have to include the TargetFramework otherwise Visual Studio will attempt to upgrade it.

<Project Sdk="Microsoft.Build.NoTargets/1.0.26">
  
  <PropertyGroup>
   <!-- 
      Any target framework you want as long as its compatible 
      with your referenced NuGet packages
     -->
    <TargetFramework>net45</TargetFramework>
  </PropertyGroup>
  
  <Target Name="HelloWorld" AfterTargets="Build">
    <Message Text="Hello World" Importance="High" />
  </Target>
  
</Project>

https://github.com/Microsoft/MSBuildSdks/releases/tag/Microsoft.Build.NoTargets.1.0.26

https://www.nuget.org/packages/Microsoft.Build.NoTargets/1.0.26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants