I grabbed this repo CommandLIneParser
and opened it in Visual Studio 2017. Build fails because Nuget fails. In the nuget package manager I see messages like this:
Dependency '"CommandLine": {
"target": "project"
}' has invalid version specification.
What does that mean and how can I resolve it?
Second problem (may be caused by the first). During build I get this error:
Error occurred while restoring NuGet packages: Invalid restore input.
UAP projects must contain exactly one target framework. Input files:
C:\Users\Jerry\Source\Repos\commandline\tests\CommandLine.Tests\CommandLine.Tests.csproj,
C:\Users\Jerry\Source\Repos\commandline\tests\CommandLine.Tests\project.json.
but both projects do, in fact, target the same framework (.net 4.5, in this case). So I'm guessing that the error message means something else?
Update:
Now that I'm looking at the two files in the error message, I'm getting a clue:
CommandLine.Tests.csproj has:
<TargetFrameworks>netstandard1.5;net40;net45</TargetFrameworks>
project.json has:
"testRunner": "xunit",
"frameworks": {
"netcoreapp1.0": {
"buildOptions": {
"define": [ "PLATFORM_DOTNET", "SKIP_FSHARP" ],
"keyFile": "../../CommandLine.snk"
},
So I see the mismatch. But that just leaves me with the somewhat-rhetorical question: "How did the last version ever build?"
Related
I'm working through the Django Tutorial (here). I'm using visual studio on a Mac and VS keeps showing an error on this code:
latest_question_list = Question.objects.order_by('-pub_date')[:5]
The error reads Class 'Question' has no 'objects' member.
The example builds a Questions Class which in fact doesn't directly have an objects member, but the code runs fine and I think that there is a built in member within Django that has objects.
So that leads me to believe that the visual studio debugger is raising an error that doesn't actually exist.
Is there a way to fix this?
I've looked through preferences/setting and under extensions to see if there is a plugin or setting reference that could be made to Django to clear the error within Visual Studio - I didn't see anything.
That is not error, just a warning from the Visual Studio Code. objects is a Manager instance which is added to our model classes dynamically by django. When VS Code checks the class declaration, it do not found objects declaration there, so warns us about a possible error.
In, Visual Studio code, python extension uses pylint as default linter.
To work it properly you can install pylint locally as:
pip install pylint
Or, you can also disable linting by configuring the following property in either one of (User or Workspace settings file) as follows:
"python.linting.enabled": false
For django projects, you can customize the pylint plugin by modifying the User or Workspace settings as follows:
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"]
For anyone who gets "Expected comma" error in User Settings, put comma to previous argument and after this one "python.linting.pylintArgs": ["--load-plugins", "pylint_django"]
Must be like this:
{
"python.pythonPath": "C:\\Program Files (x86)\\Python37-32\\python.exe",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"[python]": {
},
"python.linting.pylintArgs": [
"--load-plugins", "pylint_django"
],
}
We are getting the following "Error" message in our MVC web application in Visual studio 2017 Enterprise.
The language service is disabled for project 'C:\Work\Blackhawk
Platform\Platform-DEV-Branch\BlackhawkViewer\BlackhawkViewer.csproj'
because it included a large number of .js files. Consider excluding
files using the 'exclude' section of a 'tsconfig.json' file.
I have tried turning off the Language service in the options but this does not turn the message off:
This is a rather large web application. Is there a way to turn this message off without disabling any files in the tsconfig.json file as it suggests?
To solve this issue do the following:
Create file in root directory of your project and call it tsconfig.json
Add this:
{
"compilerOptions": {
"allowJs": true,
"noEmit": true,
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"include": [
"scripts"
],
"exclude": [
],
"typeAcquisition": {
"enable": true
}
}
Please have a look at the below two links for tsconfig.json explanation, because you may still need to change it according to your setup. This is the only way that worked for me. I hope that will help.
https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
https://developercommunity.visualstudio.com/content/problem/8148/javascript-intellisense-not-working.html
This helped me. You can have a try.
Go to Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service -> General
and uncheck the box: "Enable the new JavaScript language service.
I have found a solution for this problem.
I reset my userData using:
devenv.exe /resetuserdata
Since doing this the JavaScript settings seem to have persisted and I no longer get the language service error above.
TAKE NOTE: This will reset all your user data and customisations.
In My case I just disable TypeScript support on Visual Studio:
Tools > Extensions and Updates > TypeScript for Microsoft Visual Studio > Disable
After that, just restart Visual Studio, and you are good to go.
Hope this will help,
I had the same problem after migrating Ionic 1 project from VS2015 to VS2017, first I executed git clean -fxd as sugested above and added this content into tsconfig.json in my ionic project.
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules",
"www",
"bower_components"
]
}
I solved this problem with following solution:
When you have a JavaScript file that is included in the project.csproj file but isn't in the project folder, this error occurred.
For example I have a .csproj file like below:
<ItemGroup>
<Content Include="Scripts\Test.js" />
</ItemGroup>
The Test.js is included in the .csproj file, but it isn't in the Scripts folder:
Delete the <Content Include="Scripts\Test.js" /> line from the .csproj file and rebuild your project
Solution that worked for me:
Go to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>.
Open command prompt as admin in current folder
Ran devenv /Setup
Ran devenv /ResetSkipPkgs
For me is helping the next solution. I've create a tsconfig.json file in root of the my project with "disableSizeLimit": "true" option.
So, my tsconfig.json file is:
{
"compilerOptions": {
"disableSizeLimit": "true"
},
"exclude": []
}
If none of suggested methods worked, try:
npm install -g typescript#latest
and then
Install the latest version of TypeScript for Visual Studio on Get TypeScript.
I am running into an issue trying to include the following in the project.json:
"Microsoft.AspNet.Security.Cookies": "1.0.0-beta3",
It gives me the following error:
The dependency Microsoft.AspNet.Securitu.Cookies 1.0.0-beta3 in project TestApp does not support framework DNX, Version=v4.5.1
as well as:
The dependency Microsoft.AspNet.Securitu.Cookies 1.0.0-beta3 in project TestApp does not support framework DNXCore, Version=v5.0
These are my framworks specified:
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
And here is my complete list of dependencies:
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Security.Cookies": "1.0.0-beta2",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta5",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta7",
"Microsoft.Framework.Logging.Console": "1.0.0-beta8",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"
},
So the question is, if it is not supported "cookies" what can i use instead?, i have tried to look around but have not had any luck.
I want to add security to a small app i am building, any better suggestions would be much appreciated.
There are a few things incorrect about what you're doing:
You are mixing beta2, beta4, beta5, beta8, and rc1 packages. Since there's a lot of churn between releases, that's a recipe for disaster. Try to stick to a single release (rc1 is the latest stable).
Microsoft.AspNet.Security.* has been renamed. If you have other packages for which you cannot find the rc1 version, search the Announcements repo to see if they got renamed.
I'm trying to detect a msvc version during node-gyp configure in my binding.gyp file.
Basically, I want to be able to link against particular 3rdparty library based on Visual C++ version:
['OS=="win"' and 'toolset="vc12"' , {
'libraries': [
"opencv/lib/vc12/opencv_world300.lib"
],
}],
['OS=="win"' and 'toolset="vc11"' , {
'libraries': [
"opencv/lib/vc11/opencv_world300.lib"
],
}],
['OS=="win"' and 'toolset="vc10"' , {
'libraries': [
"opencv/lib/vc10/opencv_world300.lib"
],
}]
Unfortunately, neither toolset, nor _toolset or even $(TOOLSET) variables are defined in GYP.
I wasn't able to find such variable in GYP documentation. Is it possible at all?
I couldn't figure out from the docs that how to check for toolset version, but only found the top-level settings: https://chromium.googlesource.com/external/gyp/+/master/docs/UserDocumentation.md#Skeleton-of-a-typical-executable-target-in-a-gyp-file.
However, #saper on GitHub figured it out using MSVS_VERSION instead:
['OS=="win"' and 'MSVS_VERSION=="2013"' , {
'libraries': [
"opencv/lib/vc12/opencv_world300.lib"
],
}],
['OS=="win"' and 'MSVS_VERSION=="2012"' , {
'libraries': [
"opencv/lib/vc11/opencv_world300.lib"
],
}],
['OS=="win"' and 'MSVS_VERSION=="2010"' , {
'libraries': [
"opencv/lib/vc10/opencv_world300.lib"
],
}]
(nit: in your example, although toolset token is not identified by gyp, = should be replaced with ==)
Example: https://github.com/saper/node-sass/blob/c7e9cf0f0e0098e8316bd41722fc2edf4a835d9f/src/libsass.gyp#L91-L94.
Limitation 1:
Unfortunately, these conditions are not emitted in the .targets or .vcxproj files (such as this), but it will emit the .vcxproj after post-processing the conditions separate for the given version of MSVS and hence renders the .vcxproj file incompatible with newer/older versions of VCR.
However, the MSVS version can by overridden for gyp in multiple ways, for instance, using environment variable:
In CMD:
SET GYP_MSVS_VERSION=2012
Or in PowerShell:
$env:GYP_MSVS_VERSION=2015
It can also be passed as a command line argument:
node_modules/.bin/node-gyp build --msvs_version=2012
If both env-var and command line argument are present, CLI arg will take the precedence.
This CLI argument can be supplied to npm task, for example, to enforce the constraint for all the Windows consumers of your package to use specific version of MSVCR otherwise error.
and since so forth..
Limitation 2:
From CLI arg, there is no way to specify minimum MSVS version no such flag as: --min-msvs-version.
Limitation 3:
In case of multiple version of MSBUILD installed, node-gyp's MSBUILD discovery (at present) will ignore the preferred/required version of toolset by .vcxproj, but will give precedence to the one in PATH. In this case, you may get errors, for instance if you are using C99/C++1[1/4/7] features only offered by VS2015. To remedy this situation:
either reset PATH to the desired version MSBuild bin directory.
instead of node-gyp build or rebuild, use node-gyp configure followed by "%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild" build/binding.sln /p:Configuration=Release (or from posh, it would become: &"${env:ProgramFiles(x86)}\MSBuild\14.0\Bin\MSBuild" build\binding.sln /p:Configuration=Release)
by sending a Pull Request for node-gyp and pangyp to fix the toolset-version-aware MSBUILD discovery, if your Windows Registry skills are not as rusty as mine. :)
I am experience this strange error trying to run unit tests for WinRT from Visual Studio 2012.
Error: DEP3000: Attempts to stop the application failed. This may
cause the deployment to fail. App Packages may only be shutdown as
part of a Visual Studio build operation
I don't understand at all what that could mean? I've tried restarting my computer and reinstalling developer license. How I reproduce it is I just create a new empty unit test project from the Visual Studio template. I don't touch the project at all. But, when I try to do Run Tests on it, it just says pending for a a while and then spits out that error
How do I fix this?
Specs: Windows 8 Enterprise 64bit, Visual Studio 2012 with Update 2
Also, I've seen this question about VS2012RC, but the answer doesn't seem to apply. I've tried every configuration of this there is and nothing works past this error
I had same problem when I applied VS upgrade2 AND used Resharper 7.1.1 to run the unittests. Turns out you need to upgrade Resharper to 7.1.3 -- or run the tests with the VS test explorer.
You can just try using XUnits App:
https://channel9.msdn.com/Shows/demooftheday/xunit-in-uwp
With this, test will run on XUnit's test app, not in VS Test Explorer.
In my unit test project's project.json
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
"xunit": "2.1.0",
"xunit.runner.devices": "2.1.0" }, "frameworks": {
"uap10.0": { } }, "runtimes": {
"win10-arm": { },
"win10-arm-aot": { },
"win10-x86": { },
"win10-x86-aot": { },
"win10-x64": { },
"win10-x64-aot": { } }
}
Then go to the XAML file in the unit test project named UnitTestapp.xaml and change it to
<ui:RunnerApplication
x:Class="UnitTestProject1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnitTestProject1"
xmlns:ui="using:Xunit.Runners.UI"
RequestedTheme="Light">
</ui:RunnerApplication>
And of course, in the code behind:
sealed partial class App : RunnerApplication
{
protected override void OnInitializeRunner()
{
AddTestAssembly(GetType().GetTypeInfo().Assembly);
InitializeRunner();
}
partial void InitializeRunner();
}