Cannot create Azure Service Project Package using Azure CmdLets - powershell

I have a cloud service project in VS 2013 RTM.
I use Save-AzureServiceProjectPackage -Local command to generate CSPKG package. I am getting following error. Not sure why. Can anybody help.
Here is my Cloud CSCFG File -
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="WindowsAzure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2013-10.2.2">
<Role name="WebRole1">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
And here is my Service Definition CSDEF file -
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WindowsAzure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-10.2.2">
<WebRole name="WebRole1" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WebRole>
</ServiceDefinition>
Appreciate any help.

The latest version of Windows Azure PowerShell doesn't support packaging VS projects. The new version which will be early December 2013 will have this support.

Related

NLog not outputting anything to console

I'm following this tutorial
https://www.youtube.com/watch?v=jn6X-rx78ZU&list=PLJFgzBCcspK8p7Hxu2OLh-f-x0PBsIGjH&index=15&ab_channel=TheTutorialChef
and I'm trying to run the server at the end. NLog should output to console that server has started, but NLog is not outputting anything. I added the NLog config file below.
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<target name="Console" xsi:type="Console" layout=" ${level} ${date} ${message} ${exception:innerFormat=Message,StackTrace}" />
<!-- https://github.com/NLog/NLog/wiki/ColoredConsole-target -->
<target name="CConsole" useDefaultRowHighlightingRules="true" xsi:type="ColoredConsole" layout="${logger} ${level} ${date} ${message} ${exception:innerFormat=Message,StackTrace}" >
</target>
<target name="warnfile" xsi:type="File" fileName="${basedir}/Logs/warning.txt"
maxArchiveFiles="4"
archiveAboveSize="10240"
archiveEvery="Day" />
<target name="infofile" xsi:type="File" fileName="${basedir}/Logs/info.txt"
maxArchiveFiles="4"
archiveAboveSize="10240"
archiveEvery="Day" />
</targets>
<rules>
<!-- add your logging rules here -->
<logger name="*" minlevel="Info" maxlevel="Warn" writeTo="infofile" />
<logger name="*" minlevel="Warn" writeTo="warnfile" />
<logger name="*" minlevel="Trace" writeTo="CConsole" />
</rules>
</nlog>
But nothing outputs. There are no compilation errors or warnings. What have I done wrong? I'm using VSCode 2017, and NLog 4.7.6. I've tried editing the cofig file in the .nuget package directly. I've tried reinstalling NLog to get the original NLog.config, but now when I reinstall NLog, the config file doesn't appear in the root directory again.

Config transformation special situation

I have the following config file
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Demo" value="true"/>
<setting name="Demo2" value="true"/>
</settings>
</sitecore>
</configuration>
And I want it transformed into this
<configuration xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore role:require="Standalone OR ContentDelivery OR ContentManagement">
<settings>
<setting name="Demo" value="false"/>
<setting name="Demo2" value="true"/>
</settings>
</sitecore>
</configuration>
I have tried to use this https://fatantelopetester.apphb.com/ and obtained the following transformation config file:
<?xml version="1.0" encoding="utf-16"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xdt:Transform="SetAttributes(xmlns:role,xmlns:set)" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sitecore role:require="Standalone OR ContentDelivery OR ContentManagement" xdt:Transform="SetAttributes(role:require)">
<settings>
<setting name="Demo" xdt:Locator="Match(name)" value="false" xdt:Transform="SetAttributes(value)" />
</settings>
</sitecore>
</configuration>
But apparently this transformation is not good enough and not working.
Any ideas how to make it work, in conditions when under
<sitecore>
I have lots of other setting? (Here I've added just a sample)
I just ran into a similar issue myself and found a solution that worked for me. I'm not using SlowCheetah but I am using a tool that uses XDT under the hood.
The XDT would fail around xdt:Transform="SetAttributes(role:require)" because the namespace wasn't found. However, using xdt:Transform="SetAttributes" didn't seem to have the same problem and was able to set the attribute just fine.

Nuget Package Manager combining local and external servers

Hoping for a little help here. I've a custom built dll which has a dependency on EntityFramework. I've deployed the custom build dll to our local nuget server. However I have not deployed EntityFramework. That is available on the external nugget servers.
When I attempt to install my custom build dll using the Nuget Solution Manager, I get the following error:
Attempting to resolve dependencies for package 'CustomBuilt.dll.2016.10.10.6' with DependencyBehavior 'Lowest'
Unable to resolve dependency 'EntityFramework.dll'. Source(s) used: 'LocalServer', 'NugetAlt1', 'NugetAltHttps', 'nuget.org', 'Microsoft and .NET'.
The url's for external Servers are:
NugetAlt1: http://packages.nuget.org/v1/FeedService.svc/
NugetAltHttps: https://www.nuget.org/api/v2/
nuget.org: https://api.nuget.org/v3/index.json
Microsoft and .Net: https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/
I am using VS2015. I've also tried with VS2013.
Also I've added a nuget.config file to the solution. Still getting the error:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="LocalServer" value="http://localserver:8089/nuget" />
<add key="NugetAlt1" value="http://packages.nuget.org/v1/FeedService.svc/" />
<add key="NugetAltHttps" value="https://www.nuget.org/api/v2/" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
</configuration>
Any thoughts/ideas?
Kind Regards,
Fiona
I finally found it.. The problem was in the nuspec file that I was using to generate the package. The id of my dependencies was incorrect.
I specified the following:
<dependencies>
<dependency id = "EntityFramework.dll" version = "6.0.0.0" />
</dependencies>
This is incorrect. The package name of EF is EntityFramework not EntityFramework.dll
This is how it should be specified:
<dependencies>
<dependency id = "EntityFramework" version = "6.0.0.0" />
</dependencies>

'Spring.xml' IOException issues with migrated project from Eclipse to IntelliJ

I have pulled a Java project from TSF which another colleague created using Eclipse, however, whenever I open the project in IntelliJ it get the following runtime exception:
Exception in thread "main"
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource
[spring.xml]; nested exception is java.io.FileNotFoundException: class
path resource [spring.xml] cannot be opened because it does not exist
...
...
I have used Maven to download all the project dependencies which seem to have worked fine as I am not getting any compile time exceptions.
I have uploaded most of the project configuration settings to this imgur album, it should hopefully help.
Main.java
ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
Spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.3.xsd">
<bean id="ApplicationConfiguration" class="com.XXX.YYY.ZZZ.ApplicationConfiguration" />
<bean id="TableFactory" class="com.XXX.YYY.ZZZ.TableFactory">
<constructor-arg ref="ApplicationConfiguration" />
</bean>
<bean id="ItemFactory" class="com.XXX.YYY.ZZZ.datagen.ItemFactory"/>
<bean id="ItemWritersPool" class="com.XXX.YYY.ZZZ.ItemWritersPool">
<constructor-arg ref="ItemWriterFactory" />
<constructor-arg ref="ApplicationConfiguration" />
</bean>
<bean id="ItemWriterFactory" class="com.XXX.YYY.ZZZ.ItemWriterFactory">
<constructor-arg ref="ApplicationConfiguration" />
<constructor-arg ref="TableFactory" />
<constructor-arg ref="ItemFactory" />
</bean>
<bean id="ItemReadersPool" class="com.XXX.YYY.ZZZ.ItemReadersPool">
<constructor-arg ref="ItemReaderFactory" />
<constructor-arg ref="ApplicationConfiguration" />
</bean>
<bean id="ItemReaderFactory" class="com.XXX.YYY.ZZZ.ItemReaderFactory">
<constructor-arg ref="TableFactory" />
</bean>
</beans>
Project.iml
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<conelement value="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" />
<src_description expected_position="0">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
</src_description>
</component>
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration>
<fileset id="fileset" name="Spring Application Context" removed="false">
<file>file://$MODULE_DIR$/src/spring.xml</file>
<file>jar://$MAVEN_REPOSITORY$/io/netty/netty/3.6.3.Final/netty-3.6.3.Final.jar!/org/jboss/netty/container/spring/beans.xml</file>
<file>jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar!/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.class</file>
<file>jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar!/org/springframework/cache/annotation/AbstractCachingConfiguration.class</file>
<file>jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar!/org/springframework/context/annotation/LoadTimeWeavingConfiguration.class</file>
<file>jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar!/org/springframework/context/annotation/MBeanExportConfiguration.class</file>
<file>jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar!/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.class</file>
<file>jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar!/org/springframework/cache/annotation/ProxyCachingConfiguration.class</file>
<file>jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar!/org/springframework/scheduling/annotation/SchedulingConfiguration.class</file>
<file>file://$MAVEN_REPOSITORY$/org/springframework/spring-context/3.2.3.RELEASE/spring-context-3.2.3.RELEASE.jar</file>
</fileset>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
[-- some items manually removed --]
<orderEntry type="library" name="Maven: org.springframework:spring-core:3.2.3.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:3.2.3.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:3.2.3.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:3.2.3.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:3.2.3.RELEASE" level="project" />
[-- some items manually removed --]
</component>
</module>
Any advise and/or suggestion will greatly appreciated. Thanks in advance!
Everything seems ok in your config so I checked using a small project and it appears that the problem may come from the redundant namespaces you are using in your XML headers.
Try modifying the following this:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.3.xsd">
To result in something like this:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
If that does not work you can also tweak your .iml file by doing the following:
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true". You can test quickly by replacing true with false and let IntelliJ reload your project.
I don't know why IntelliJ ignore your spring.xml file, but if you use 2 separate directories for sources and resources, as Maven suggests, your problem should disappear.
You should also create the directory src/main/resources and place your spring.xml file there.
Hope this helps.
Sometimes this can be a problem with the working dir. This blog post explains the problem and how to fix it.
IntelliJ differs from Eclipse in that it sets the working directory to project root which may not be the same as the top level directory of the module you are working on.
This can be fixed in the run configurations by setting the working directory to $MODULE_DIR$.
If this helps maybe set the working directory in Default JUnit run configuration as well as
and fixing all remaining run configurations.

nlog files with a date

In a C# 2008 application, I want to write the NLog error log files out so that the files have a date on them. In the example listed below, you can see that I have 3 log files. Can you tell me how place a month-day-year format on these files?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" fileName="C:\Logs\NlogOutput.log" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
</nlog>
Use something like this for your fileName parameter:
fileName="${basedir}/${shortdate}.log"
Generally speaking, you can use most NLog LayoutRenderers to help compose your filename.