Does anyone know when scons will support Visual Studio 2013?
The latest release, 2.3.1, is hard coded to look for 6.0 up to 11.0. But no entries for 12.0.
VS 2013 has been released for a few months. I'm surprised this is lacking.
Thanks
Shane
I too was looking for VS 2013 (vs12) support (for scone 2.3.0) and I found this link:
D146 SCons visual studio 2013 support
I made the same simple changes to the 3 files as described there, and, voila, vs12 now works...
Unmarking as an answer. Turns out there was an issue on a machine with just VS2013.
I managed to work around it by calling
SCons.Tool.MSCommon.vc.__INSTALLED_VCS_RUN=['12.0']
It works. But such a bad practice that I can't encourage it in good faith.
It turns out official support is still pending. I've talked to the developers and they believe it should be part of the next release.
Like hplate I came across a patch for scons.
https://bitbucket.org/scons/scons/pull-request/104/support-visual-studio-2013/diff
The code here only supports VS2013 Express. But it was simple to modify it for VS2013.
That worked well enough. But I did not want to force ~300 other developers to use a patched version of scons.
Luckily our build system creates one Environment & clones it as needed. My solution
def RegGetValue(root, key, _32bit = True):
"""This utility function returns a value in the registry
without having to open the key first. Only available on
Windows platforms with a version of Python that can read the
registry.
"""
if not SCons.Util.can_read_reg:
print "ERROR: Python cannot read the Windows registry! - Crashing out..."
sys.exit(-1)
p = key.rfind('\\') + 1
keyp = key[:p-1] # -1 to omit trailing slash
val = key[p:]
if _32bit:
flags = 0x20219 # KEY_READ (0x20019), KEY_WOW64_32KEY (0x0200)
else:
flags = 0x20119 # KEY_READ (0x20019), KEY_WOW64_64KEY (0x0100)
try:
k = SCons.Util.RegOpenKeyEx(root, keyp, 0, flags)
except Exception as e:
import traceback
traceback.print_stack()
print "ERROR: Python cannot read the Windows registry (" + key + ")"
print "Please ensure you have the correct Visual Studio, Micrsoft SDK, and .NET installed"
print "Crashing out....."
sys.exit(-1)
return str(SCons.Util.RegQueryValueEx(k,val)[0])
# As of version 2.3.1 scon's does not have built in support for Visual Studio 2013.
# Manually setting the appropriate environmental settings after the env has been created.
# Once scons officially supports 2013 consider removing these.
# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\InstallPath
# C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
dot_net4_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Client\\InstallPath", _32bit=False)
# HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Setup\VS
# C:\Program Files (x86)\Microsoft Visual Studio 12.0\
vs_2013_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VS\\ProductDir")
# HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots\KitsRoot81
# C:\Program Files (x86)\Windows Kits\8.1\
kit8_1_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots\\KitsRoot81")
# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A\InstallationFolder
# C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\
# Need to investigate if this should be 8.1A
sdk_8_1_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1\\InstallationFolder")
LIBPATH = (
dot_net4_directory + ';'
+ vs_2013_directory + 'VC\\LIB\\amd64;'
+ vs_2013_directory + 'VC\\ATLMFC\\LIB\\amd64;'
+ kit8_1_directory + 'References\\CommonConfiguration\\Neutral;'
+ '\\Microsoft.VCLibs\\12.0\\References\\CommonConfiguration\\neutral'
)
LIB = (
vs_2013_directory + 'VC\\LIB\\amd64;'
+ vs_2013_directory + 'VC\\ATLMFC\\LIB\\amd64;'
+ kit8_1_directory + 'lib\\winv6.3\\um\\x64'
)
PATH = (
vs_2013_directory + 'Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow;'
+ vs_2013_directory + 'VC\\BIN\\amd64;'
+ dot_net4_directory + ';'
+ vs_2013_directory + 'VC\\VCPackages;'
+ vs_2013_directory + 'Common7\\IDE;'
+ vs_2013_directory + 'Common7\\Tools;'
+ vs_2013_directory + 'Team Tools\\Performance Tools\\x64;'
+ vs_2013_directory + 'Team Tools\\Performance Tools;'
+ kit8_1_directory + 'bin\\x64;'
+ kit8_1_directory + 'bin\\x86;'
+ sdk_8_1_directory + 'bin\\NETFX 4.5.1 Tools\\x64\\;'
+ 'C:\\Windows\\System32'
)
INCLUDE = (
vs_2013_directory + 'VC\\INCLUDE;'
+ vs_2013_directory + 'VC\\ATLMFC\\INCLUDE;'
+ kit8_1_directory + 'include\\shared;'
+ kit8_1_directory + 'include\\um;'
+ kit8_1_directory + 'include\\winrt'
)
# Setup the Visual Studio 2013 variables
# Note: The default 'ENV' values are fine
# on a machine with VS2008 & VS2010 installed
# Unclear about machines with just VS2013.
# Needs investigation.
# env['ENV']['TMP'] = default
# env['ENV']['COMSPEC'] = default
# env['ENV']['TEMP'] = default
# env['ENV']['SystemDrive'] = default
# env['ENV']['PATHEXT'] = default
env['ENV']['LIBPATH'] = LIBPATH
env['ENV']['LIB'] = LIB
env['ENV']['PATH'] = PATH
# env['ENV']['SystemRoot'] = default
env['ENV']['INCLUDE'] = INCLUDE
env['MSVC_VERSION'] = '12.0'
env['GET_MSVSPROJECTSUFFIX'] = '.vcxproj'
env['MSVSPROJECTSUFFIX'] = '.vcxproj'
env['MSVS'] = {'SOLUTIONSUFFIX': '.sln', 'PROJECTSUFFIX': '.vcxproj'}
env['MSVSENCODING'] = 'utf-8'
env['MSVS_VERSION'] = '12.0'
Caveat: So far I've only tested this on a machine with VS2008, VS2010, & 2013 installed. I'm going to test it on VS2013 only machine and will update this post if there are any issues.
FYI. VS2013 support should be available in the next release of SCons (aka 2.3.2). The pull requests have been merged.
https://bitbucket.org/scons/scons/pull-request/104/support-visual-studio-2013/diff
https://bitbucket.org/scons/scons/pull-request/120/adding-support-for-visual-studio-2013/diff
Visual Studio is now part of the latest scons releases. If this will not work for you I suggest look at hplate's answer.
Related
First, I use WinRT::MiracastReceiver(Win10 sdk) by "Windows Application Packaging Project" in Win32/C++ project.
https://learn.microsoft.com/zh-tw/windows/msix/desktop/desktop-to-uwp-packaging-dot-net.
So It already has package identity(Private Networks and Internet C/S capability).
And I check this API has DualApiPartition property, so the desktop app can call the WinRT API.
https://learn.microsoft.com/zh-tw/windows/win32/apiindex/uwp-apis-callable-from-a-classic-desktop-app
When I start a MiracastReceiver session, I get the result MiracastNotSupported?
How can I solve this?
When I put the same code in WinRT/UWP project, it's successful.
int main()
{
winrt::init_apartment();
receiver_ = MiracastReceiver();
receiver_.StatusChanged( {&OnStatusChanged} );
MiracastReceiverSettings settings = receiver_.GetDefaultSettings();
settings.FriendlyName(L"MiracastReceiver.2020.1217");
settings.AuthorizationMethod(MiracastReceiverAuthorizationMethod::None);
settings.ModelName(receiver_.GetDefaultSettings().ModelName());
settings.ModelNumber(receiver_.GetDefaultSettings().ModelNumber());
settings.RequireAuthorizationFromKnownTransmitters(false);
auto settings_sts = receiver_.DisconnectAllAndApplySettings(settings);
session_ = receiver_.CreateSession(nullptr);
session_.AllowConnectionTakeover(true);
session_.ConnectionCreated( {&OnConnectionCreated} );
session_.Disconnected( {&OnDisconnected} );
session_.MediaSourceCreated( {&OnMediaSourceCreated} );
MiracastReceiverSessionStartResult result = session_.Start();
MiracastReceiverSessionStartStatus status = result.Status();
std::wostringstream message;
message << L"ClickHandler: session_.Start, status=" << (int)status << std::endl;
OutputDebugString(message.str().c_str());
system("PAUSE");
}
status = MiracastNotSupported
env:
Visual Studio 2017 v15.9.30
Win10 SDK 10.0.19041.0
Win10 OS 2004 (19041)
I spent 8 hours on this exact problem, and eventually found out that if I compile the app as x64 instead of targeting [Any CPU] I could get it to work.
I would like to add two conditional properties to my project configuration to target a non-default vcpkg triplet: https://github.com/microsoft/vcpkg/blob/master/docs/users/integration.md#with-msbuild
My project files are generated by premake. How would I go about this?
you could try to override the global function from the visual studio generator some thing like this ... not tested ...
local vs2010 = premake.vstudio.vs2010
function vcPkgOverride(prj)
-- go trough the configs and platforms and figure out which conditions to put
for _, cfg in pairs(prj.cfgs) do
local condition = vs2010.condition(cfg)
if cfg.platform == "Win32" then
vs2010.vc2010.element("VcpkgTriplet ", condition, "x86-windows-static")
else if cfg.platform == "x64" then
vs2010.vc2010.element("VcpkgTriplet ", condition, "x64-windows-static")
end
end
end
premake.override(vc2010.elements, "globals", function (oldfn, prj)
local elements = oldfn(prj)
elements = table.join(elements, {
vcPkgOverride
})
end
return elements
end)
UPDATE
The code above doesn't seem to work for premake5.0.0-alpha14 so I tweaked it based on the docs and here you have a less general, but working version:
require('vstudio')
local vs = premake.vstudio.vc2010
local function premakeVersionComment(prj)
premake.w('<!-- Generated by Premake ' .. _PREMAKE_VERSION .. ' -->')
end
local function vcpkg(prj)
premake.w('<VcpkgTriplet>x64-windows-static</VcpkgTriplet>')
premake.w('<VcpkgEnabled>true</VcpkgEnabled>')
end
premake.override(premake.vstudio.vc2010.elements, "project", function(base, prj)
local calls = base(prj)
table.insertafter(calls, vs.xmlDeclaration, premakeVersionComment)
return calls
end)
premake.override(premake.vstudio.vc2010.elements, "globals", function(base, prj)
local calls = base(prj)
table.insertafter(calls, vs.globals, vcpkg)
return calls
end)
Add this at the start of your main premake5.lua script, or find a way to include it from somewhere else (I don't know much about lua or premake I just needed to fix this and wanted to show it to the community)
Have you tried using CMake instead? It's a far more sophisticated build system that should handle this trivially.
The problem is that if the application is "stopped" this will return nothing. But i still want to uninstall it anyway. I don't know the application name, i'm getting all applications installed on a Server and then uninstalling them all.
apps = AdminControl.queryNames('type=Application,node=' + nodeName + ',process=' + serverName + ',*').split()
Here is my code.
serverObj = AdminControl.completeObjectName('type=Server,node=%s,name=%s,*' % (nodeName, serverName))
serverID = AdminConfig.getid('/Node:%s/Server:%s/' % (nodeName, serverName))
if serverID == "":
print "Can't find the server, exiting..."
sys.exit(1)
else:
cellName = AdminControl.getAttribute(serverObj, 'cellName')
#Uninstall Apps
apps = AdminControl.queryNames('type=Application,node=' + nodeName + ',process=' + serverName + ',*').split()
appManager=AdminControl.queryNames('type=ApplicationManager,node=' + nodeName + ',process=,*')
if len(apps) > 0:
for app in apps:
appName = AdminControl.getAttribute(app, 'name')
AdminControl.invoke(appManager,'stopApplication', appName)
print "Uninstalling application: " + appName
AdminApp.uninstall(appName)
else:
print "No applications to uninstall"
You can use the below snippet to uninstall all Apps deployed on the target server:
#Get the list of all Apps deployed in target server
installedApps=AdminApp.list("WebSphere:cell=%s,node=%s,server=%s" % (cellName, nodeName, serverName))
#Check if there are any installed Apps on the server
if len (installedApps) > 0:
#if there are installed Apps, iterate through the list and uninstall Apps one by one
for app in installedApps.splitlines():
print "uninstalling "+ app +" ...."
AdminApp.uninstall(app)
#Save the changes
AdminConfig.save()
else:
#if there are no installed Apps, do nothing
print "No applications to uninstall"
You can use AdminApp.list() to obtain the list of apps for a target scope. So for server scope:
AdminApp.list("WebSphere:cell=yourCellName,node=yourNodeName,servers=yourServerName”)
With that information, you can then use AdminApp.uninstall() to uninstall the app, for example:
AdminApp.uninstall('NameOfApp')
How can I get a list of installed VisualStudio extensions? Somehow through DTE? Just the names would be fair enough.
Does this help:
System.IServiceProvider serviceProvider = package as System.IServiceProvider;
Microsoft.VisualStudio.ExtensionManager.IVsExtensionManager em =
(Microsoft.VisualStudio.ExtensionManager.IVsExtensionManager)serviceProvider.GetService(
typeof(Microsoft.VisualStudio.ExtensionManager.SVsExtensionManager));
string result = "";
foreach(Microsoft.VisualStudio.ExtensionManager.IInstalledExtension i in em.GetInstalledExtensions())
{
Microsoft.VisualStudio.ExtensionManager.IExtensionHeader h = i.Header;
if (!h.SystemComponent)
result += h.Name + " (by " + h.Author + ") v" + h.Version + " " + h.MoreInfoUrl + System.Environment.NewLine;
}
Copied from https://vlasovstudio.com/visual-commander/commands.html #20.
Another possibility, if you don't want DTE, because you are not running from within Visual Studio or are concerned about performance you can query the extensions from the file system / registry:
For User Extensions
%LocalAppData%\Microsoft\VisualStudio*.vsix
For General Extensions
\Common7\IDE\Extensions*.vsix
IF you want to be 100% correct you can look up the paths in
\Common7\IDE\devenv.pkgdef
NOTE: There can be additional paths in the PkgDefSearchPath.
To check wether a User Extensions is enabled or not you have to query the registry:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\ExtensionManager\EnabledExtensions
There are some other rules that apply, which you can find in this blog from Microsoft:
http://blogs.msdn.com/b/visualstudio/archive/2010/02/19/how-vsix-extensions-are-discovered-and-loaded-in-vs-2010.aspx
Based on IBM documentation, I wrote a jython script that adds shared libs to an existing application.
# Application name
app = sys.argv[0]
dep = AdminConfig.getid('/Deployment:' + app + '/')
depObject = AdminConfig.showAttribute(dep, 'deployedObject')
classldr = AdminConfig.showAttribute(depObject, 'classloader')
for x in range(1, len(sys.argv)):
AdminConfig.create('LibraryRef', classldr,
[['libraryName', sys.argv[x]], ['sharedClassloader', 'true']])
AdminConfig.save()
Unfortunately, this is setting the shared library only for the application and not for the modules. How could I achieve setting the libraries for both ?
I tried to get the modules of an application but I cannot get the classloader of it.
BTW, what is the sharedClassloader attributes used for ?
Note: I know this is bad practice, but I inherited a bunch of legacy applications, so please don't advice to get rid of shared libs or to add a deployment.xml
Well, here is the working script addSharedLibrary.py <application-name> shared-lib [shared-lib...]
def addSharedLibrary(holder):
classldr = AdminConfig.showAttribute(holder, 'classloader')
for x in range(1, len(sys.argv)):
AdminConfig.create('LibraryRef', classldr, [['libraryName', sys.argv[x]], ['sharedClassloader', 'true']])
def handleWebModules(applicationName):
webModules = AdminConfig.list('WebModuleDeployment').split('\n')
for webModule in webModules:
if (webModule.find(applicationName) != -1):
print 'Setting for ' + webModule
addSharedLibrary(webModule)
dep = AdminConfig.getid('/Deployment:' + sys.argv[0] + '/')
addSharedLibrary(AdminConfig.showAttribute(dep, 'deployedObject'))
handleWebModules(app)
AdminConfig.save()
I think a good way to accomplish this is to create a shared library at the server level, and then create a classloader also on the server level in order to load the libraries.
set serv [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
print AdminConfig.create('Library', serv, [['name', 'mySharedLibrary'], ['classPath',
'home/myProfile/mySharedLibraryClasspath']])
AdminConfig.create('Library', serv, [['name', 'mySharedLibrary'],
['classPath','test1.jar;test2.jar;test3.jar']])
appServer = AdminConfig.list('ApplicationServer', serv)
print appServer
classLoad = AdminConfig.showAttribute(appServer, 'classloaders')
cleanClassLoaders = classLoad[1:len(classLoad)-1]
classLoader1 = cleanClassLoaders.split(' ')[0]
classLoader1 = AdminConfig.create('Classloader', appServer, [['mode', 'PARENT_FIRST']])
print AdminConfig.create('LibraryRef', classLoader1, [['libraryName', 'MyshareLibrary']])
AdminConfig.save()
AdminNodeManagement.syncActiveNodes()
Thanks poussma for your jython script, it works on the previous version of WAS...
so i adjusted your code to make it work also on WAS8 :
Run the cmd line with : addSharedLibrary.py <application-name> [shared-lib...]
def addSharedLibrary(holder):
classldr = AdminConfig.showAttribute(holder, 'classloader')
for x in range(1, len(sys.argv)):
AdminConfig.create('LibraryRef', classldr, [['libraryName', sys.argv[x]], ['sharedClassloader', 'true']])
def handleWebModules(applicationName):
webModules = AdminConfig.list('WebModuleDeployment').split('\r')
webModules = map(lambda s: s.strip(), webModules)
for webModule in webModules:
if (webModule.find(applicationName+'.ear') != -1):
print 'Setting for ' + webModule
addSharedLibrary(webModule)
dep = AdminConfig.getid('/Deployment:' + sys.argv[0] + '/')
addSharedLibrary(AdminConfig.showAttribute(dep, 'deployedObject'))
handleWebModules(sys.argv[0])
AdminConfig.save()