Closed RehanSaeed closed 7 years ago
@RehanSaeed can you share a sample?
@sayedihashimi I have a branch. Just try opening the solution and building.
Doing some more investigation, I looked at the section in ligershark.templates.targets(532,5)
causing the problem:
<!-- TODO: now that we are copying the entire folder I think this step can be removed -->
<Copy SourceFiles="@(_ls-NewProjFilesToCopyRaw->'$(_ls-TemplateFolder2)%(Identity)')"
DestinationFiles="@(_ls-NewProjFilesToCopyRaw->'$(ls-DestTemplateOutputRoot)%(Identity)')">
<Output TaskParameter ="CopiedFiles" ItemName="ls-temp-FilesCopied"/>
</Copy>
I'm not sure what these lines do. The comment added by @sayedihashimi suggests that it's not needed, so I tried removing it and I was able to build a VSIX again. I've not validated the VSIX works yet as I've run out of time but it does contain my projects.
Yes I looked at that a while ago and I'm pretty sure we can remove that. Can you verify and send a PR? I'll release an update.
@sayedihashimi I just tested removing those lines:
How about non core projects? This could be a bug in the Roslyn project system.
My MVC 5 project (non .NET Core) gets created just fine.
@RehanSaeed can you share the .vsix which shows this behavior?
@sayedihashimi Here is a link to my VSIX on MyGet: https://www.myget.org/feed/aspnet-mvc-boilerplate/package/vsix/MvcBoilerplateVsix.Microsoft.dafd466d-39dc-487e-846b-7cf0e569821c/6.0.0
Raised this PR to partly fix this issue: https://github.com/ligershark/template-builder/pull/98.
I occasionally get the following random error that stops the VSIX building but I can use this potential fix: https://github.com/Microsoft/visualfsharp/pull/1751 which builds the VSIX but I still get build errors. This does leave me unable to debug.
error VSSDK1081: Problem occurred while extracting the vsix to the experimental extensions path.
I can generate a VSIX from Visual Studio 2017 but can't seem to run MSBuild.exe to generate the VSIX file. When running the command below, the project files and other files get copied and zipped but a VSIX file is not generated.
C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe" /v:normal /p:Configuration="Release" /p:Platform=AnyCPU /p:DeployExtension=false /target:Build "C:/code/Templates/Source/Boilerplate.Vsix/Boilerplate.Vsix.csproj
When I run my code to edit and delete files, Visual Studio 2017 crashes with the error below.
System.ObjectDisposedException occurred
HResult=0x80131622
Message=Cannot access a disposed object.
Source=Microsoft.VisualStudio.Validation
StackTrace:
at Microsoft.Verify.NotDisposed(IDisposableObservable disposedValue, String message)
at Microsoft.VisualStudio.ProjectSystem.OnceInitializedOnceDisposed.EnsureInitialized(Boolean allowInitializing)
at Microsoft.VisualStudio.ProjectSystem.ProjectTreeProviderBase.SubmitTreeUpdateAsync(TreeUpdateAsyncDelegate treeTransformation, IImmutableDictionary`2 updatedSources, TreeSubmissionOptions options, Int64& generationNumber, CancellationToken cancellationToken)
at Microsoft.VisualStudio.ProjectSystem.VS.Tree.Dependencies.DependenciesProjectTreeProvider.OnDependenciesChanged(Object sender, DependenciesChangedEventArgs e)
at Microsoft.VisualStudio.Web.PackageManagement.SolutionExplorer.ProjectDependenciesAdapterBase.OnDependenciesChanged(DependenciesChangedEventArgs args)
at Microsoft.VisualStudio.Web.PackageManagement.SolutionExplorer.ProjectDependenciesAdapterBase.InvalidateGraph(Object sender, EventArgs e)
at Microsoft.VisualStudio.Web.PackageManagement.Npm.NpmPackageProvider.FirePackagesChanged()
at Microsoft.VisualStudio.Web.PackageManagement.Npm.NpmPackageProvider.<RefreshRootNode>d__55.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Web.PackageManagement.Utilities.BatchingTaskScheduler.<Invoke>d__6.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
:(
@shanselman Nice to see you share my pain. Building a VSIX is extremely frustrating process, every VS upgrade breaks something. Would like to move to dotnet new
but VS is where the users are at. dotnet new
could really use a UI in Visual Studio.
Have raised Build a UI in Visual Studio for dotnet new Templates as an issue.
Sorry for the delay. Work has been insane lately and at home I have a newborn young infant, so I'm finding it hard to get time. I'm starting to look at this. I'm guessing that the build logic for building a vstemplate into a vsix has some breaking changes. I'll reply back here after I get more info.
@RehanSaeed I can see the branch you linked above. Is it somewhere else?
@sayedihashimi Congrats on the baby, it takes about a year to get some sleep :) Although, I still sometimes have trouble with my little girl.
Merged into master. I'm planning to release a hacked together VSIX that:
Not ideal but at least I can release something.
@RehanSaeed I've merged your PR and released it as TemplateBuilder.1.1.5-beta.nupkg
. In that release I also made another minor change. When the .vstemplate file was being generated there were two ProjectItem
s listed
Microsoft.ApplicationInsights.AspNetCore
Microsoft.AspNetCore
Those files must be coming in from .net core .targets/.props files but I haven't figured out which one yet. For now I've just special cased them and explicitly excluded them. If you see the same issue in your hacked version you can add those values to the ls-ProjectTemplateFilesToRemoveOnCopy
item and you don't need to update the .targets file.
About the issue you mentioned about not being able to build the .vsix. I created a new vsix project in VS for testing templates and I was able to build the vsix with the following command. I think maybe -visualStudioVersion
is the missing property that you should add but not sure. Also check to make sure you are building with the correct msbuild.exe
.
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" ".\VSIXProject1\VSIXProject1.csproj" /p:VisualStudioVersion=15.0 /m
I'm still looking into this issue. Will reply back here when I get more info to share.
Thanks for that!
A lot of people are getting the error VSSDK1081: Problem occurred while extracting the vsix to the experimental extensions path.
error. See MSDN and https://github.com/Microsoft/extendvs/issues/41. It's hitting the 254 file path length limit in .NET. The solution is to use a short product title, publisher name and template name (Not ideal).
Thanks for that, I can do CI again! Your secret MSBuild argument /p:VisualStudioVersion=15.0
got it building.
I still get the following exception when overwriting files in the project when applying the users feature selections. This looks like a .NET Core tooling issue:
System.ObjectDisposedException occurred
HResult=0x80131622
Message=Cannot access a disposed object.
Source=Microsoft.VisualStudio.Validation
StackTrace:
at Microsoft.Verify.NotDisposed(IDisposableObservable disposedValue, String message)
at Microsoft.VisualStudio.ProjectSystem.OnceInitializedOnceDisposed.EnsureInitialized(Boolean allowInitializing)
at Microsoft.VisualStudio.ProjectSystem.ProjectTreeProviderBase.SubmitTreeUpdateAsync(TreeUpdateAsyncDelegate treeTransformation, IImmutableDictionary`2 updatedSources, TreeSubmissionOptions options, Int64& generationNumber, CancellationToken cancellationToken)
at Microsoft.VisualStudio.ProjectSystem.VS.Tree.Dependencies.DependenciesProjectTreeProvider.OnDependenciesChanged(Object sender, DependenciesChangedEventArgs e)
at Microsoft.VisualStudio.Web.PackageManagement.SolutionExplorer.ProjectDependenciesAdapterBase.OnDependenciesChanged(DependenciesChangedEventArgs args)
at Microsoft.VisualStudio.Web.PackageManagement.SolutionExplorer.ProjectDependenciesAdapterBase.InvalidateGraph(Object sender, EventArgs e)
at Microsoft.VisualStudio.Web.PackageManagement.Npm.NpmPackageProvider.FirePackagesChanged()
at Microsoft.VisualStudio.Web.PackageManagement.Npm.NpmPackageProvider.<RefreshRootNode>d__55.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Web.PackageManagement.Utilities.BatchingTaskScheduler.<Invoke>d__6.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Released an update. Issue 3 seems to be gone the last time I tried after updating VS. Will create a new VS tooling issue if it re-occurs.
I still show a modal warning dialogue telling the user to expect VS to crash just in case :(.
I get the following error for every NuGet package in my template project (.NET Core csproj) while trying to build my VSIX using Visual Studio:
@RandomlyKnighted Any ideas if the new format is supported.