Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Windows form e console application

Pessoal, estou tentando criar um form em C# para utilizar a biblioteca "Caelum Stella CSharp" que é para validação e formatação de CPF, CNPJ e Titulo Eleitoral. Criei o form no VS e quando tentei instalar pelo "Manage NuGet Packages" retorna uma mensagem dizendo que a configuração para o form é inválido . Tentei driblar o problema e criei um projeto no formato "Console application" e por esta opção eu consigo utilizar o "Manage NuGet Packages", por lá eu consigo também adicionar um form, porém, quando executo o programa ele mostra o prompt do windows aberto juntamente com o form. Poderiam me ajudar em algum dos problemas ? Valeu!

3 respostas
solução!

Olá, Patric!

Fiz um teste aqui instalando o pacote num projeto Windows Forms e funcionou (Veja as mensagens de instalação abaixo).

Precisamos saber exatamente como é essa mensagem de erro. Você está usando qual Visual Studio?

Pode colocar por gentileza as mensagens da instalação do pacote ? As mensagens aparecem na janela Output, em Show Output from Package Manager.

Obrigado



Attempting to gather dependency information for package 'Caelum.Stella.CSharp.1.4.7' with respect to project 'WindowsFormsApp1', targeting '.NETFramework,Version=v4.5.2'
Gathering dependency information took 11,48 sec
Attempting to resolve dependencies for package 'Caelum.Stella.CSharp.1.4.7' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Caelum.Stella.CSharp.1.4.7'
Resolved actions to install package 'Caelum.Stella.CSharp.1.4.7'
Retrieving package 'Caelum.Stella.CSharp 1.4.7' from 'nuget.org'.
Retrieving package 'Microsoft.NETCore.Platforms 1.1.0' from 'nuget.org'.
Retrieving package 'NETStandard.Library 1.6.1' from 'nuget.org'.
Retrieving package 'Newtonsoft.Json 10.0.2' from 'nuget.org'.
Retrieving package 'System.Collections 4.3.0' from 'nuget.org'.
Retrieving package 'System.Collections.Concurrent 4.3.0' from 'nuget.org'.
Retrieving package 'System.Diagnostics.Debug 4.3.0' from 'nuget.org'.
Retrieving package 'System.Diagnostics.Tools 4.3.0' from 'nuget.org'.
Retrieving package 'System.Diagnostics.Tracing 4.3.0' from 'nuget.org'.
Retrieving package 'System.Globalization 4.3.0' from 'nuget.org'.
Retrieving package 'System.IO 4.3.0' from 'nuget.org'.
Retrieving package 'System.IO.Compression 4.3.0' from 'nuget.org'.
Retrieving package 'System.Linq 4.3.0' from 'nuget.org'.
Retrieving package 'System.Linq.Expressions 4.3.0' from 'nuget.org'.
Retrieving package 'System.Net.Http 4.3.0' from 'nuget.org'.
Retrieving package 'System.Net.Primitives 4.3.0' from 'nuget.org'.
Retrieving package 'System.ObjectModel 4.3.0' from 'nuget.org'.
Retrieving package 'System.Reflection 4.3.0' from 'nuget.org'.
Retrieving package 'System.Reflection.Extensions 4.3.0' from 'nuget.org'.
Retrieving package 'System.Reflection.Primitives 4.3.0' from 'nuget.org'.
Retrieving package 'System.Resources.ResourceManager 4.3.0' from 'nuget.org'.
Retrieving package 'System.Runtime 4.3.0' from 'nuget.org'.
Retrieving package 'System.Runtime.Extensions 4.3.0' from 'nuget.org'.
Retrieving package 'System.Runtime.InteropServices 4.3.0' from 'nuget.org'.
Retrieving package 'System.Runtime.InteropServices.RuntimeInformation 4.3.0' from 'nuget.org'.
Retrieving package 'System.Runtime.Numerics 4.3.0' from 'nuget.org'.
Retrieving package 'System.Text.Encoding 4.3.0' from 'nuget.org'.
Retrieving package 'System.Text.Encoding.Extensions 4.3.0' from 'nuget.org'.
Retrieving package 'System.Text.RegularExpressions 4.3.0' from 'nuget.org'.
Retrieving package 'System.Threading 4.3.0' from 'nuget.org'.
Retrieving package 'System.Threading.Tasks 4.3.0' from 'nuget.org'.
Retrieving package 'System.Threading.Timer 4.3.0' from 'nuget.org'.
Retrieving package 'System.Xml.ReaderWriter 4.3.0' from 'nuget.org'.
Retrieving package 'System.Xml.XDocument 4.3.0' from 'nuget.org'.
Adding package 'Microsoft.NETCore.Platforms.1.1.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'Microsoft.NETCore.Platforms.1.1.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'Microsoft.NETCore.Platforms.1.1.0' to 'packages.config'
Successfully installed 'Microsoft.NETCore.Platforms 1.1.0' to WindowsFormsApp1
Adding package 'Newtonsoft.Json.10.0.2' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'Newtonsoft.Json.10.0.2' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'Newtonsoft.Json.10.0.2' to 'packages.config'
Executing script file 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages\Newtonsoft.Json.10.0.2\tools\install.ps1'...
Successfully installed 'Newtonsoft.Json 10.0.2' to WindowsFormsApp1
Adding package 'System.Collections.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Collections.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Collections.4.3.0' to 'packages.config'
Successfully installed 'System.Collections 4.3.0' to WindowsFormsApp1
Adding package 'System.Collections.Concurrent.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Collections.Concurrent.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Collections.Concurrent.4.3.0' to 'packages.config'
Successfully installed 'System.Collections.Concurrent 4.3.0' to WindowsFormsApp1
Adding package 'System.Diagnostics.Debug.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Diagnostics.Debug.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Diagnostics.Debug.4.3.0' to 'packages.config'
Successfully installed 'System.Diagnostics.Debug 4.3.0' to WindowsFormsApp1
Adding package 'System.Diagnostics.Tools.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Diagnostics.Tools.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Diagnostics.Tools.4.3.0' to 'packages.config'
Successfully installed 'System.Diagnostics.Tools 4.3.0' to WindowsFormsApp1
Adding package 'System.Diagnostics.Tracing.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Diagnostics.Tracing.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Diagnostics.Tracing.4.3.0' to 'packages.config'
Successfully installed 'System.Diagnostics.Tracing 4.3.0' to WindowsFormsApp1
Adding package 'System.Globalization.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Globalization.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Globalization.4.3.0' to 'packages.config'
Successfully installed 'System.Globalization 4.3.0' to WindowsFormsApp1
Adding package 'System.IO.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.IO.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.IO.4.3.0' to 'packages.config'
Successfully installed 'System.IO 4.3.0' to WindowsFormsApp1
Adding package 'System.IO.Compression.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.IO.Compression.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.IO.Compression.4.3.0' to 'packages.config'
Successfully installed 'System.IO.Compression 4.3.0' to WindowsFormsApp1
Adding package 'System.Linq.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Linq.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Linq.4.3.0' to 'packages.config'
Successfully installed 'System.Linq 4.3.0' to WindowsFormsApp1
Adding package 'System.Linq.Expressions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Linq.Expressions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Linq.Expressions.4.3.0' to 'packages.config'
Successfully installed 'System.Linq.Expressions 4.3.0' to WindowsFormsApp1
Adding package 'System.Net.Http.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Net.Http.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Net.Http.4.3.0' to 'packages.config'
Successfully installed 'System.Net.Http 4.3.0' to WindowsFormsApp1
Adding package 'System.Net.Primitives.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Net.Primitives.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Net.Primitives.4.3.0' to 'packages.config'
Successfully installed 'System.Net.Primitives 4.3.0' to WindowsFormsApp1
Adding package 'System.ObjectModel.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.ObjectModel.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.ObjectModel.4.3.0' to 'packages.config'
Successfully installed 'System.ObjectModel 4.3.0' to WindowsFormsApp1
Adding package 'System.Reflection.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Reflection.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Reflection.4.3.0' to 'packages.config'
Successfully installed 'System.Reflection 4.3.0' to WindowsFormsApp1
Adding package 'System.Reflection.Extensions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Reflection.Extensions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Reflection.Extensions.4.3.0' to 'packages.config'
Successfully installed 'System.Reflection.Extensions 4.3.0' to WindowsFormsApp1
Adding package 'System.Reflection.Primitives.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Reflection.Primitives.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Reflection.Primitives.4.3.0' to 'packages.config'
Successfully installed 'System.Reflection.Primitives 4.3.0' to WindowsFormsApp1
Adding package 'System.Resources.ResourceManager.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Resources.ResourceManager.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Resources.ResourceManager.4.3.0' to 'packages.config'
Successfully installed 'System.Resources.ResourceManager 4.3.0' to WindowsFormsApp1
Adding package 'System.Runtime.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.4.3.0' to 'packages.config'
Successfully installed 'System.Runtime 4.3.0' to WindowsFormsApp1
Adding package 'System.Runtime.Extensions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.Extensions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.Extensions.4.3.0' to 'packages.config'
Successfully installed 'System.Runtime.Extensions 4.3.0' to WindowsFormsApp1
Adding package 'System.Runtime.InteropServices.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.InteropServices.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.InteropServices.4.3.0' to 'packages.config'
Successfully installed 'System.Runtime.InteropServices 4.3.0' to WindowsFormsApp1
Adding package 'System.Runtime.InteropServices.RuntimeInformation.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.InteropServices.RuntimeInformation.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.InteropServices.RuntimeInformation.4.3.0' to 'packages.config'
Successfully installed 'System.Runtime.InteropServices.RuntimeInformation 4.3.0' to WindowsFormsApp1
Adding package 'System.Runtime.Numerics.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.Numerics.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Runtime.Numerics.4.3.0' to 'packages.config'
Successfully installed 'System.Runtime.Numerics 4.3.0' to WindowsFormsApp1
Adding package 'System.Text.Encoding.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Text.Encoding.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Text.Encoding.4.3.0' to 'packages.config'
Successfully installed 'System.Text.Encoding 4.3.0' to WindowsFormsApp1
Adding package 'System.Text.Encoding.Extensions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Text.Encoding.Extensions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Text.Encoding.Extensions.4.3.0' to 'packages.config'
Successfully installed 'System.Text.Encoding.Extensions 4.3.0' to WindowsFormsApp1
Adding package 'System.Text.RegularExpressions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Text.RegularExpressions.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Text.RegularExpressions.4.3.0' to 'packages.config'
Successfully installed 'System.Text.RegularExpressions 4.3.0' to WindowsFormsApp1
Adding package 'System.Threading.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Threading.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Threading.4.3.0' to 'packages.config'
Successfully installed 'System.Threading 4.3.0' to WindowsFormsApp1
Adding package 'System.Threading.Tasks.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Threading.Tasks.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Threading.Tasks.4.3.0' to 'packages.config'
Successfully installed 'System.Threading.Tasks 4.3.0' to WindowsFormsApp1
Adding package 'System.Threading.Timer.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Threading.Timer.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Threading.Timer.4.3.0' to 'packages.config'
Successfully installed 'System.Threading.Timer 4.3.0' to WindowsFormsApp1
Adding package 'System.Xml.ReaderWriter.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Xml.ReaderWriter.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Xml.ReaderWriter.4.3.0' to 'packages.config'
Successfully installed 'System.Xml.ReaderWriter 4.3.0' to WindowsFormsApp1
Adding package 'System.Xml.XDocument.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Xml.XDocument.4.3.0' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'System.Xml.XDocument.4.3.0' to 'packages.config'
Successfully installed 'System.Xml.XDocument 4.3.0' to WindowsFormsApp1
Adding package 'NETStandard.Library.1.6.1', which only has dependencies, to project 'WindowsFormsApp1'.
Adding package 'NETStandard.Library.1.6.1' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'NETStandard.Library.1.6.1' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'NETStandard.Library.1.6.1' to 'packages.config'
Successfully installed 'NETStandard.Library 1.6.1' to WindowsFormsApp1
Adding package 'Caelum.Stella.CSharp.1.4.7' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'Caelum.Stella.CSharp.1.4.7' to folder 'c:\users\marce\documents\visual studio 2017\Projects\WindowsFormsApp1\packages'
Added package 'Caelum.Stella.CSharp.1.4.7' to 'packages.config'
Successfully installed 'Caelum.Stella.CSharp 1.4.7' to WindowsFormsApp1
Executing nuget actions took 1,72 min
Time Elapsed: 00:01:56.7769902
========== Finished ==========

Marcelo, eu realizei o reparo no meu Visual Studio e consegui inserir. Eu utilizo o Visual Studio community. Obrigado cara.

Excelente, Patric! Por um momento tomei um susto, achei que o pacote não estava funcionando com Windows Forms ;-) Abraços!